jquery - toggleClass animation not working? or need help toggling animation -
i working code:
$('#products h2').click( function() { $('.well').toggleclass('margin-left260', 100000); return false; } );
what want slide div on 260 using left margin, , have slide on click 0. don't understand why .toggleclass not animating me.
i did earlier using .animate(margin-left,'260px); life of me figure out how use toggle have return margin of 0. missing here?
i have added jsfiddle example here - http://jsfiddle.net/baxyr/
basically
$('.clickme').click(function(){ if($('#moveme').hasclass('marginleft260')){ $('#moveme').animate({ marginleft: "-=260px", }, 5000, function() { $(this).removeclass('marginleft260'); }); }else{ $('#moveme').animate({ marginleft: "+=260px", }, 5000, function() { $(this).addclass('marginleft260'); }); } });
Comments
Post a Comment