2011-11-13 8 views
0
$(".somediv").hover(
    function() { 
     $(this).animate({'margin-top':'100px'},1000); 
    }, 
    function() { 
     $(this).animate...… 
    } 
); 
$(".somediv").click(function ....????  

La question est de savoir comment puis-je figer l'animation sur un clic dans la marge supérieure: 100px état ne pas laisser onmouseout fonction arriver après somediv a été cliquéGel vol stationnaire onclick

Mais clic suivant devrait dégeler les fonctions de vol stationnaire Merci à l'avance


stop() ne contribue pas à empêcher unhovering

$("#one.button").hover(function() { 
$(this).animate({'margin-top':'30px'},{queue:false,duration:700}); 
}, function() { 
$(this).animate({'margin-top':'10px'},{queue:false,duration:700}); 
    }); 

$("#one.button").click(function(){ 
$("#one.button").stop().animate({'margin-left':'0px'},{queue:false, duration:700}); 
}); 

après un cliC# one.button est animée à la marge gauche: 0px et après qu'il est unhovered à margin-top: 10px

Répondre