help with jquery stop/dequeue
For my first real foray into jquery, I picked a doozie. I wanted a "pull down, bouncing nav with a pull down search bar). After tinkering for longer than I should admit, I arrived very happily at this: http://jsfiddle.net/2RqmU/38/
This does everything I want, just how I want it, with one exc开发者_运维问答eption: The search icon is queuing activity/hovers, and I can't figure out how to prevent it. It's unclear to me why ".stop(true, false)." isn't working as it does on the animations of the other icons. I thought maybe this was a job for dequeue, but that's not helping either.
Any help greatly appreciated! Nearly there....
I'm not sure the appropriate etiquette here. I just wanted to flag that this is only partially resolved. The answer does effectively stop the queuing but a new hover/move-over forces the sliding to start anew (from the resting place), even if it hasn't returned to its resting place. In other words, the sliding "resets" immediately on re-hover. That makes it jerky on a quick re-hover, before the icon had a chance to return to its resting place. The stop true/false on the other animations works fine in this respect. But I can't get that same effect on the search icon, which operates by sliding (not animation as such). Thanks.
If you add the two appropriate cases of .stop(true, true)
and change the search animation to this, it stops queuing for me:
$('#search-area').hover(function() {
$('#search-reveal-container').stop(true, true).slideDown(200);
}, function() {
if (!$('#query').is(':focus')) {
$('#search-reveal-container').stop(true, true).slideUp({
duration: 800,
easing: 'easeOutBounce'
});
}
})
See here: http://jsfiddle.net/jfriend00/WGNa4/
精彩评论