我使用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