下のようにstopメソッドを実行した場合、animateメソッドで仕込んでいたコールバックが発火するというのに今更ながら気がつきました。
<div id="container"
style="border:solid 1px red;height:100px;width:100px;">
</div>
<div>
<input type="button" value="Stop" id="lv_stop">
</div>
<script>
jQuery(function($){
var nTimerId = setTimeout(function(){
$('#container').animate({
'marginLeft':'1000px'
},5000,function(){
console.log('hoge')
});
$('#lv_stop').bind('click',function(event){
event.preventDefault();
$('#container').stop(true,true);
});
},2000);
});
</script>
もちろん、下のソースでもキックされます。
<div id="container"
style="border:solid 1px red;height:100px;width:100px;">
</div>
<div>
<input type="button" value="Stop" id="lv_stop">
</div>
<script>
jQuery(function($){
var nTimerId = setTimeout(function(){
$('#container').animate({
'marginLeft':'1000px'
},5000,function(){
console.log('hoge')
});
$('#lv_stop').bind('click',function(event){
event.preventDefault();
$('#container').stop(false,true);
});
},2000);
});
</script>
当初、コールされるとはまったく思っていなかったので、今後、実装する場合に、気をつけたいですね。