我使用TweenLite來完成一些SVG動畫,但由於某種原因,每次我重新加載頁面時,第一次將光標懸停在動畫元素上時,動畫的破壞都是即時的。然後在第一次立即添加懸停效果後,動畫正常工作。setTimeout的問題
只需重新加載頁面,懸停的對象,你會看到我收到的錯誤。
$('svg').hover(function() {
/* Stuff to do when the mouse enters the element */
var currentCirc = $(this).find('.social-circle');
currentCirc.stop()
.animate({'stroke-dashoffset': 0}, 1000);
TweenLite.to(currentCirc, 1, {fill:'rgb(144, 17, 133)'});
console.log('on');
}, function() {
/* Stuff to do when the mouse leaves the element */
var currentCirc = $(this).find('.social-circle');
currentCirc.stop()
.animate({
'stroke-dashoffset': 900
}, 1000);
TweenLite.to(currentCirc, 1, {fill:'none'});
// .css('fill', 'none');
});
感謝您的時間!
謝謝你的幫助!這完美的作品!現在我可以拋出一些這個JS。 – Zlerp