それぞれが段落のタイトルである 4 つの DIV のセットがあります。各 DIV をホバーで展開して短い段落を表示し、マウスアウトで元に戻すようにします。jQuery は正常に機能しています。唯一の問題は、カーソルを 4 つの DIV の上で数回すばやく前後にトレースすると、関数が壊れているように見えることです。
それが行うことは、識別可能なパターンなしで、さまざまな DIV をランダムに拡大および縮小するだけです。
$('#iam_writer').hover(function(){
$(this).animate({'height' : '120px'}, 'slow');
$(this).on('mouseleave',function(){
$(this).animate({'height' : '25px'}, 'fast');
});
});
$('#iam_social').hover(function(){
$(this).animate({'height' : '135px'}, 'slow');
$(this).on('mouseleave',function(){
$(this).animate({'height' : '25px'}, 'fast');
});
});
$('#iam_creative').hover(function(){
$(this).animate({'height' : '135px'}, 'slow');
$(this).on('mouseleave',function(){
$(this).animate({'height' : '25px'}, 'fast');
});
});
$('#iam_strategic').hover(function(){
$(this).animate({'height' : '140px'}, 'slow');
$(this).on('mouseleave',function(){
$(this).animate({'height' : '30px'}, 'fast');
});
});
おそらくこれを達成するためのより良い方法がありますか?