我尝试使用此
var a ='1200';
var b= '400';
var current_slide = $('.swiper-slide-active');
var current_twenty = current_slide.find('.twentytwenty-wrapper');
var current_twentyCont = current_twenty.find('.twentytwenty-container');
var current_twentyContBefore = current_twentyCont.find('img.twentytwenty-before');
current_twentyContBefore.animate({ clip: "rect(0px,"+a+"px,"+b+"px, 0px)"; }, 1000 );
但它不起作用。我尝试不使用jquery animate fx.step
任何解决问题的方法?
答案 0 :(得分:0)
尝试以下
current_twentyContBefore.animate({
fontSize: 100 //some unimportant CSS to animate so we get some values
},
{
step: function(now, fx) { //now is the animated value from initial css value
$(this).css('clip', 'rect(0px, '+now+'px, '+now+'px, 0px)')
}
}, 1