It is in fact a tiny detail so it has to work in that size also. Excuse me the eye hurting ;-)
First of all: the code that I did so far works in a way but not quite sober.
It means that it depends sometimes from which side the mouse arrives over the divs etc. to make it react a little „nervous“.
Here is briefly what I wanted to achieve.
The „plus“ symbol is at first only clickable.
Once clicked the second time the mouse moves over it, also reveals a „minus“ symbol offering the possibilities:
1) to return to the beginning (in fact if you click the plus a text is zoomed in via font-size and when you click minus it returns at once to the original font-size value) via click on it
2) go on clicking on the „plus“ (if you want the text to see even one step bigger)
I also wanted an identical mouseleave event for two actions:
1) click the „minus“ -> „minus“ symbol turns in again
2) leave the whole +- area with the mouse -> „minus“ symbol turns in again also
As I said it works as it is right now but not very constantly.
Sometimes when the mouse moves over the plus f.e. the „-“ comes out very briefly and at once returns in (which avoids it being clickable)
I believe it has to do with the (for me) very consistent problem that a mouseenter in a child element is interpretated as a mouseleave of its parent (which it shouldn’t!!)
My question is:
How has this to be done in a professional way?
For I am relative beginner and I don’t know better how to do it.
Then I try to install two functions (one would be even better) to make either the first and the second div change their places or the first and the third (depending which div is clicked.
(The fourth element in the menu remains static)
I tried so much but this is all what I could achieve so far:
I know that this is crap but it is the nearest I came and most of all it works only (badly yet) 2 or 3 times then the functions make each other crash. I tried so hard and have the doubt that the point is that the off() in the function do not work at all, so that there remain several functions attached after a while to the divs.
I urgently need help!! I am getting nuts :-(
Thanks for any hints about this!
Garavani
PS the additional class exchanges are needed for another hover effect so that this is additional
which works as a switch for CSS stylesheets mobile device/regular monitor.
This works very satisfying and it inspires me to extend this function to also introduce different external script files. So that certain functions in the mobile device variant disappear or change compared to the bigger sized page.
I posted this question in another place but didn’t get any answers, so I will try again in a little more abstract way.
I am having trouble in understanding a principle thing.
Is it possible to animate (=move) a div that is relative - but so that the attached divs that lay in the flow of the page behind it change their position, too?
I am having big troubles to make this come true properly.
To explain: no problem to put other divs INSIDE the animated div and make them so move parallel to the parent.
But I need them OUTSIDE the div but still want that it moves in the same way without extra selecting it and animating it, too.
I am (as a beginner) stuck in a problem with a custom event I created (for the first time).
The situation is that I have a template dynamically loaded in my main page that in it contained a div #character.
At the time the template is inserted in the containing div (on the main page) #character (as part of the new inserted html) has to be invisible.
Then I wanted to create a custom event called "fullPageReady" that is triggered in a seperate function to tell the div #character to fade in (and other things, too). In one word to start a range of functionality previously „sleeping“.
The function to start it (as I said after it is already inserted in the main html) is:
function blindFullPage(){
…
$(window).trigger( "fullPageReady" );
…
});
Sadly nothing happens :-(
I guess it has to do with this js is not declarative thing or the need of event delegation
for probably on the time the template code is parsed the trigger is not yet done and afterwards it doesn’t pass by again. But I don’t know. It’s too high for me. :-(
What I am doing wrong here and
how is this to be done properly?
Certainly I could bind the functionality directly in the trigger function but this I don’t like to because the function serves for many different occasions and I can not bind all eventualities or do if else etc.
There must be a cool way to do things like these, isn’t there?
Thanks a lot
would be a great help for me also to understand finally the custom event thing.
it is needed to fadeOut/In arrows if the user reaches (by several ways) the beginning or the end of a slider, so that reaching the first picture the backward arrow appears and other way around if he reaches the last one the forward arrow disappears. Naturally they have to reappear if the user moves from there on again.
I am sure there is a shorter more elegant way to do those kind of things.
is there someone how can help me? I am definitely stuck within this problem
I am quite used now (as beginner yet) to use e.data with my functions but now I want to go a step further as I have dynamic data to pass to a function.
I am working with Jquerys cookbook and there is the chapter „Passing Dynamic Data to Event Handlers“.
Yet, it seems I am too stupid to understand this :-(
I have in my case the following code (part of a simple (not for me;-) slider):
I have a little general question about to handle two animated pages which I’d like to combine.
For I am a relative beginner this time I’d like to hear some advice and ideas BEFORE I start programming what I have in mind.
If you’d have the patience to take a look at the 2 html in action (yet very unfinished, but as I said I would want to become clear on which basic way to succeed):
If you click on the first one the arrow in the right corner on the bottom I did a blind effect with Jquery UI (maybe this is not the final word also, maybe it could be done with a simpler overflow invisible div that contains all content).
After this „blind” fade effect I would like to let the second page appear moved also fromm down to up simultaneously.
I hope it’s clear what I attempt to do.
Click on the arrow bottom and the second pages content appears from below.
Yet could be that after a while the contents of each page will get more complicated and so I would avoid to be unflexible (and to put things in tiny divs each animated etc.).
First thing that came in mind to me was Iframes, but I read in many places that it is not particularly wise to do so.
Another vague (beginner) idea would be to insert the new html content after the effect via Jquery dynamically, i.e. if the effect is done (or while better) the first content has to cancelled the second appended via a .html operation.
Am I totally wrong here or which way would you go?
Would be a great help to know your opinions before starting a (for me) difficult scripting.
lately I discovered that some animation of mine ( that workes fine on most today browsers) does not so with the older 3.0.4 Safari I have on my old MacBook. (Yet it works fine with an even older Camino on it)
For certain reasons (of window resizing) I cannot animate the height itself so I animated the relative top position. How said it works perfect all around (the ones I tested at least) except Safari 3.0.4 how showes only the initial and abrupt final state of the whiteLine element.
Someone with an idea?
Has it do with the percenatage, the way CSS is interpreted differently?
that uses one „factor“ to resize, reposition (centering) and zoom elements.
Works satisfying.
But now I would want that from some other place (while animations are running) this „factor“ could be changed (possibly beeing animated to, but this later)
How could I change from some function the e.data later?
I know that this has something to do with custom Event and in theory I know the way but I have difficulties in understanding and using e.data and trigger(…) at the same time.
Because I like that the e.data is known at the beginning but could be neverthelss changed LATER on, too.
I admit it is quite complex, yet, I do not quite understand why it is able to bind and keeo the click function on each title but not the hover events. (they seem to be fired only once and not properly)
Maybe it helps to see the current result to understand what I want under:
Here it should be the fold out menu on the bottom left of the page.
When the mouse goes over the appearing titles (after they completely folded out) the should hint at the click event by enlarging a little the titles („Gucci“, „Bulgari“ etc.)
Basically I put 2 sub folders in my "images" folder named "reg" and "ita". In there are pictures which I wanted to change their resource in the divs by introducing a variable so that the paths would look like:
for days I am now thinking about how to solve my problem here with a (relative) simple fold out menu.
I think that it is somehow a „classic“ but despite of much google and reading I can not fix it.
I need some professional help.
I will attach also a screenshot that showes dreamweaver layout to show elements.
I will explain what I want to achieve:
When then mouse hovers over the word „Collection lettre“ out of it will appear above (these are animated switching from absolute to relative position while moving upwards and fading in done with:
Now my problem is that each of this out coming items have to have a mouseenter and leave behaviour themselves, which I also resolved and also I managed to make the foldout menu fold in when those are clicked, BUT
what is wanted and needed that the menu will fold in when the mouse leaves it, NOT the word itself (because obviously the user has to be able to click the distanced item with the menu collapsing first)
I can’t work with a class making the div which contains „Collection lettre“ itself because this will destroy the animation (besides it doesn’t work good). I tried to install a second field below attaching the mouseleave behaviour to it like:
<div id = "foldout" class="item firstleft foldout"> </div>
<div id = "folder" class="item firstleft"> </div>
…
$("#folder")
.mouseenter(function(){
var currTitle = $("#gwork").val();
$('#folder img')
.not('#title_'+currTitle)
.each(folderOut)
.css('cursor', 'pointer')
});
$("#foldout")
.mouseleave(function(){folderIn();});
});
[see also screenshot layout]
I tried doing a lot of things either hover or mouse enter/leave combinations nothing works perfect only partially. With the second field for example the mouseleave works only leaving the folder div in the upwards direction and so on…
Unfortunately I can also not use mouse position coordinates for a script because the elements are positioned with % changing position relating to window size :-(
Come on guys you know what I mean, do you?
Can someone help me to unknot the colliding mouse enters, leaves and hovers?
1) in the first part (which works fine and is the code in regular character)
to create divs with a variable based id (to be animated elsewhere)
but :
2) I need to bind on each on this titles different click behaviors depending each on the id that it has.
For that (and for other reasons) I made the e.data function „workChoice“.
Yet, instead of giving to it a fixed data like „3“ for example (which will show work_3 besides other things always staying the same) I have to pass the data from the „title_x“ variable instead of a fixed value.
Now what I tried to code here (in bold character) always passes the value 4 to „selwork“ (selected work) giving it to all title divs behaviours.
(its like an accordian moving out above the parent menu title)
but when the visible title changes attribute the new title presented would have to be excluded from the fold out so that everytime only the remaining titles would show on the hover.
I recognize that it was a little complicated to explain :-(
Hope though that someone understands what I mean and could lend me a hand.
I thought about using an array in a variable that could exlcude everytime another of its elements, or something like this, but I am not firm enough to write a proper code.