サンプルのボックスに連続してホバーしてください。チラチラしますよね。
$('#s1 div.box')
.hover(function() {
$(this).animate({
opacity: .5
}, {
duration: 200
})
}, function() {
$(this).animate({
opacity: 1
}, {
duration: 200
})
});
連続してホバーすると、ぴかぴかしますね!
$('#s2 div.box')
.hover(function() {
$(this).stop(true, true).animate({
opacity: .5
}, {
duration: 200
})
},function() {
$(this).stop(true, true).animate({
opacity: 1
}, {
duration: 200
})
});
キューがたまっている状態で他のブロックにホバーすると、キャンセルします。たぶん一番自然。
$('#s3 div.box')
.hover(function() {
$(this).stop(true, false).animate({
opacity: .5
}, {
duration: 200
})
}, function() {
$(this).stop(true, false).animate({
opacity: 1
}, {
duration: 200
})
});
キューがたまっている状態で他のブロックにホバーすると、キャンセルします。.stop(true, false)と同じ効果。これも自然。
$('#s4 div.box')
.hover(function() {
$(this).animate({
opacity: .5
},{
duration: 200,
queue: false
})
}, function() {
$(this).animate({
opacity: 1
}, {
duration: 200,
queue: false
})
});