Re: [jQuery] Slide down / Slide up, stop repeating

2010-03-02 Thread Nathan Klatt
On Mon, Mar 1, 2010 at 11:35 AM, Paul Collins  wrote:
> My problem is that if someone hovers over the .content multiple times,
> the JQuery remembers and keeps popping the menu up and down

>From http://api.jquery.com/stop/:

We can create a nice fade effect without the common problem of
multiple queued animations by adding .stop(true, true) to the chain:

$('#hoverme-stop-2').hover(function() {
  $(this).find('img').stop(true, true).fadeOut();
}, function() {
  $(this).find('img').stop(true, true).fadeIn();
});

I don't like how this jerks the in animation to its end then starts
the out animation - it would be nice if it would freeze the in
animation and start the out animation from there but things get messed
up with jumpToEnd (the second param) set to false.

Nathan


[jQuery] Slide down / Slide up, stop repeating

2010-03-01 Thread Paul Collins
Hi all

I've got a drop down menu that expands when you hover over a heading. Here
is the JQuery

$("#header .dropDown .content").hover(
  function () {
$("#header .dropDown ul").slideDown();
return false;
  },
  function () {
$("#header .dropDown ul").slideUp();
return false;
  }
);

My problem is that if someone hovers over the .content multiple times, the
JQuery remembers and keeps popping the menu up and down even when you've
taken the mouse away. Is there a way to stop it remembering this? I've tried
adding the ".stop()" to the function, but this will stop it half way if you
hover out too early.

If anyone has encountered this before, could you tell me how you got around
it?!

Thanks for any help