问题
I have a very simple animation, were I have a tab at the side of the screen and if you click it, it will increase size. But it´s only working on IE, here is the code:
<script>
$(function(){
$("#a-tab > *").focusin(function(){
$("#a-tab").animate({width:'320px'});
});
$("#a-tab > *").focusout(function(){
$("#a-tab").animate({width:'10px'});
});
});
</script>
It has to be #a-tab > * because of the inside content
Were is the problema, how can I make it compatible with Chrome, Firefox, etc.
回答1:
U can try sumthin like this:
<script>
$(function(){
$("#a-tab > *").focusin(function(){
$("#a-tab").stop().animate({width:'320px'});
});
$("#a-tab > *").focusout(function(){
$("#a-tab").stop().animate({width:'10px'});
});
});
</script>
Just add .stop() before .animate(). I hope that works for u :)
来源:https://stackoverflow.com/questions/24588821/jquery-animation-only-working-in-ie