animation - jQuery switchClass -
Is it possible to undo a switchclass
infection?
I want to, as soon as you press it to get an element gradually to the class A
, and gradually after the mouse is moved it will again However, the function seems unclear, and does not help to call .stop (0,1).
does not seem to help, in fact, it seems to break it.
I have a live example Yes, this is a 404 page, but it is not important to get the navigation slowly or to lose a square, but it just jumps. The script can be found.
Is such an infection possible?
Edit:
I am using this code:
$ ('# navbar li: not (.current) a' ). Hover (function {$ (this) .Parent () .stop (1.0) .addClass ('current', 1000);}, function () {$ (this) .Parent (.) Stop (1.0) .removeClass ('current', 1000);});
Is it because of the change of the class of li
can not its children be infected?
EDIT2:
Yes, that 'fixed' it. The real bug can now be seen in all its glory (being stabilized in an intermediate state).
This is the closest I've come to work on:
Example:
Some may overlap, and you : animated
selector, though I had trouble earlier.
Can not be worth the effort ...
HTML
& lt; Div id = 'myElement' class = 'blue' & gt; Content & lt; / Div & gt;
css
div {width: 100px; Height: 100 pixels; }. Blue {background: blue; Status: Relative; Left: 20px; }. MyClass {Background: Red; Margin-top: 50px; }
jQuery
var animating = false; Var interval; $ ('# MyElement') Hover (function () {var $ th = $ (this); if (! Animating & amp; Interval) {$ th.clearQueue (); Animating = true; $ th.addClass ('MyClass', 500, function } {Animating = false;}}}}}, function () {var $ th = $ (this); if (interval) returns incorrectly; if (animating) {interval = setInterval (function () (if (animating! ) {$ Th.clearQueue}; Animating = true; $ th.removeClass ('myClass', 500, function) {animating = false;}); clear interval (interval); interval = null;}}, 50)} and {$ Th.clearQueue (); $ th.rem OveClass ('myClass', 500, function () {animating = false;});}});
Comments
Post a Comment