我想使用jquery animate和easing并曾经使用它并看到它正常工作,但是现在我遇到了一个新问题。看来它没有考虑我的配置。
我通过CDN调用jquery.3.4.1和jquery.easing.min.js。我所有的代码都运行良好,没有任何错误。我试过了jQuery ui,它是相同的。我动画的最终结果是,当鼠标离开时,它会等待持续时间(200、3000,无论如何),然后快速给marginLeft动画。好像没有考虑持续时间。
$('#sliderContent > #nav').on({
mouseenter: function() {
$('.slide-background.cover.present > .slide-background-content').animate({
marginLeft: '+'+$('#nav').outerWidth(true)+'px'
}, 200 );
},
mouseleave: function() {
$('.slide-background.cover.present > .slide-background-content').animate({
marginLeft: '0px'
}, 1000, 'easeOutBounce');
}
});
编辑:问题实际上出在CSS上。我发现我的类.slide-background.cover.present > .slide-background-content
的DIv具有过渡效果,其缓解程度设置为缓解。