mianmalife / notebook

记录一下
2 stars 0 forks source link

jquery动态修改background-position做动画 #7

Open mianmalife opened 5 years ago

mianmalife commented 5 years ago
$('.yy-platform').mouseenter(function() {
           $('.yy-learn-more').css({'color': '#de3b33', 'borderColor': '#de3b33'});
           clearInterval(this.timer2);
           var count = 0;
           this.timer = setInterval(function(){
            count -= 90;
            $('.yy-platform').css('backgroundPositionY',count<=-1440? -1440: count);
           },340/17);
        }).mouseleave(function() {
            $('.yy-learn-more').css({'color': '#868686', 'borderColor': '#868686'});
            clearInterval(this.timer);
            var count = -1440;
            this.timer2 = setInterval(function(){
            count += 90;
            $('.yy-platform').css('backgroundPositionY',count>=-90? -90: count)
           },340/17);
        });
mianmalife commented 5 years ago

鼠标移入播放动画 移除返回原样