私は8つのサムネイルを持っており、行の最初のサムネイルの上にマウスを置くと、他の7つは50%の透明度にアニメーション化され、マウスを外すと100%に戻ります。他の親指についても同じです。
問題は、マウスオーバーを左から右にすばやく開始するときに、すべてを非常に速く(左から右に、またはギャラリーの左側から右側に)マウスオーバーすると、アニメーション化されて停止しないことです。したがって、サムネイルが7つあり、それらの上にマウスをすばやく置くと、アニメーションが7倍再生されます。左から右に高速でロールオーバーすると、14回のロールオーバーなどになります...(アニメーションスタック)
ポイントは、アニメーションが止まらないということです。そして、私は理由を理解しましたが、それを修正する方法がわかりません。私は試しました.stop()
が、それですべてが止まりました。アニメーションの時間も短縮しようとしましたが、すでに500msなので、通常のオン/オフスイッチのように短くなっています。.delay(number here)も試しましたが、うまくいきませんでした。
これがJsフィドルです。http://jsfiddle.net/somdow/y3vCP/
念のため、
この例のHTML(jsFiddleと同じ)は次のとおりです。
<div class="portThumbsL">
<a href="images/sitePortThumbs/2882.png"><img src="images/sitePortThumbs/2882.png" alt="2882films"/></a>
<div class="thumbTxtSmall">2882FILMS</div>
</div>
<div class="portThumbsL">
<a href="images/sitePortThumbs/2882.png"><img src="images/sitePortThumbs/1tech.png" alt="1-tech"/></a>
<div class="thumbTxtSmall">2882FILMS</div>
</div>
<div class="portThumbsL">
<a href="images/sitePortThumbs/2882.png"><img src="images/sitePortThumbs/brazen.png" alt="brazen"/></a>
<div class="thumbTxtSmall">2882FILMS</div>
</div>
</ p>
Cssは次のとおりです。
.portThumbsL{position:relative; width:245px; height:387px; float:left; background-color:#333; margin-right:14px;}
.portThumbsR{position:relative;width:245px; height:387px; float:right; background-color:#333; margin-left:px;}
.portThumbsL img, .portThumbsR img{display:block; margin:6px auto;}
</ p>
jQueryは次のとおりです。
$('.portThumbsL , .portThumbsR').hover(function(){
$(this).children('.portSecRollOver').css("display","block");
$(this).find('.portSecInner').html("<h3 class='h34roll'>" + $(this).find('img').attr('alt') + "</h3>");
//$('.portThumbsL, .portThumbsR').not(this).css("opacity", .5);
$('.portThumbsL, .portThumbsR').not(this).animate({opacity:.5},500);
},
function(){
$(this).children('.portSecRollOver').css("display","none");
$('.portThumbsL, .portThumbsR').not(this).animate({opacity:1},500);
});
ですから、私の全体的な質問は、どうすれば狂わずに正常に再生されるようにすることができるかということです。