【发布时间】:2018-03-14 23:36:00
【问题描述】:
我想在滚动到固定位置时移动图片,当我向下滚动 800 像素时我想移动图片。
我的问题是,当我向下滚动时,图像正在移动,但在向下滚动时它会闪烁,并且在我向上滚动时也会闪烁。
Javascript:
if ($(window).width() >= 1024) {
$(window).scroll(function(){
if ($(window).scrollTop() >= 800){
$('.Pic_mv').each(function (i) {
$(this).toggleClass('scrolled');
});
}else if ($(window).scrollTop <= 800){
$('.Pic_mv').each(function (i) {
$(this).toggleClass('.Pic_mv');
});
}
}) ;
}
CSS:
.Pic_mv {
border-radius: 100%;
margin-top: 30px;
margin-bottom: 25px;
transition: transform 300ms ease-in-out;
}
.Pic_mv.scrolled {
transform: translate(85%, 1300px) ;
}
我怎样才能获得流畅的动画?
【问题讨论】:
标签: jquery html css image animation