0
マウスがリンク上で高速に動いている場合、バグを避けるために、ホバーにsetTimeoutを追加しようとしています。TweenMaxでsetTimeoutのホバー
お持ちの場合は、私は...
$(document).ready(function(){
var delay=200, setTimeoutConst;
$('.thumb').hover(function(){
setTimeoutConst = setTimeout(function(){
$(".thumb").hover(over, out);
function over(){
TweenMax.to($(this).find(".title_thumb"), 0.3, {display:"block" , opacity:"1" , marginTop:"20px" , ease:Power2.easeOut , delay:"0.2"})
TweenMax.to($(this).find(".view_thumb"), 0.3, {display:"block" , opacity:"1" , ease:Power2.easeOut , delay:"0.5"});
TweenMax.to($(this).find(".layer_thumb"), 0.02, {opacity:"1" , ease:Power2.easeOut});
}
function out(){
TweenMax.to($(this).find(".title_thumb"), 0.3, {display:"none" , opacity:"0" , marginTop:"0px" , ease:Power2.easeOut})
TweenMax.to($(this).find(".view_thumb"), 0.2, {display:"none" , opacity:"0" , marginTop:"0px" , ease:Power2.easeOut})
TweenMax.to($(this).find(".layer_thumb"), 0.02, {opacity:"0" , ease:Power2.easeOut});
}
}, delay);
},function(){
clearTimeout(setTimeoutConst);
})
})
をシンプルsetTimeoutを何もこのコードの
setTimeout(function over(){
TweenMax.to($(this).find(".title_thumb"), 0.3, {display:"block" , opacity:"1" , marginTop:"20px" , ease:Power2.easeOut , delay:"0.2"})
TweenMax.to($(this).find(".view_thumb"), 0.3, {display:"block" , opacity:"1" , ease:Power2.easeOut , delay:"0.5"});
TweenMax.to($(this).find(".layer_thumb"), 0.02, {opacity:"1" , ease:Power2.easeOut});
}, 200);
ともしてみましたが、それを動作させるために見つけることができませんでした私は本当に嬉しいだろう任意のアイデア!
でJSのいずれかのホバーコールを置き換える、jQueryの後にあなたのスクリプトにhoverintentを追加するためのペンを作ったそれを作るための方法はありますjQueryでのみ?また、私はそれが何をしないのですか? –
https://briancherne.github.io/jquery-hoverIntent/ jQueryの補足です。それは何をするためのものか?そのデモの例に移動して、マウスを4つの四角形間を素早く行き来させてください。あなたが動くのを止めると、すべてが動揺し続けているので、アニメーションが維持されます。 HoverIntentには、タイムアウトが完了してから実行されるまで関数が実行されないようにカスタマイズできる初期遅延があります。マウスを他の例より速く動かしてその差異を見ることができます。 – Zuriel
そのリンクの最初のデモは通常のjQueryです。残りのリンクはhoverIntentで表示されます。 – Zuriel