2011-07-20 13 views
1

不透明度をアニメーション化しようとしています。デフォルトの不透明度はすべてのサムネイルで0.8です。一度ホバリングすると、不透明度は1に増加し、別のサムネイルが上げられると0.8に戻るはずです。jqueryのギャラリーでアクティブ(ホバー)サムネイルの不透明度をアニメーション化する

私はこのコードを試してみた:マウスは、同じサムネイルの上に残っているとされていない場合でも、

container.delegate("a:has(img)", "mouseenter", function(e){ 
    $(e.currentTarget).stop(true, true).animate({opacity: 1}, options.thumbsopacityFadeTime); 
}).delegate("a:has(img)", "mouseout", function(e){ 
    $(e.currentTarget).stop(false, true).animate({opacity: options.thumbsOpacity}, options.thumbsopacityFadeTime); 
); 

時にはホバーサムネイル(ほとんどの時間)は、バックデフォルトの不透明度に行きます移動した。

これは、現在実行中のアニメーションと何か関係があると思いますが、$(e.currentTarget)はこの1サムネイルにのみ適用されると思ったので、なぜそのサムネイルに対してマウス出力イベントがトリガーされるのですか?私はサムネイルを残しませんか?

これを修正する方法についてのご意見はありますか?

おかげで、 ウェズリー

答えて

1

は、私はあなたがマウスアウト効果を持ってしたくないことを理解しましたか?異なるサムネイルをホバリングする場合のみ?

"mouseout"を "mouseleave"に置き換える必要があります。問題が解決しない場合は、別の方法で試してみてください。

var obj = container.find("a:has(img)"); 

obj.bind({ 
    mouseenter:function(){ 
    obj.stop().not(this).animate({opacity: options.thumbsopacity}, options.thumbsopacityFadeTime); 
    $(this).animate({opacity: 1}, options.thumbsopacityFadeTime); 
    }, 
    mouseleave:function(){ 
    // nothing :) 
    } 
}); 
+0

ありがとうございました。 DOH! – Wesley

関連する問題