; jquery:从当前屏幕位置开始动画动画,使页面向下移动100px [英] ;Jquery: animate page down 100px from current screen position
本文介绍了; jquery:从当前屏幕位置开始动画动画,使页面向下移动100px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从当前屏幕位置开始滚动动画,向下滚动一定数量的像素.
I need to animate a scroll from the current screen position, down a set number of pixels.
$('html,body').animate({
scrollTop: $(window).position().top += 100
});
还是?
$('html,body').animate({
scrollTop: '+=100px'
});
推荐答案
只需更改:
scrollTop: $('body').position().top += 100
对此:
scrollTop: $(window).scrollTop() + 100
请参阅演示: http://jsfiddle.net/fpxuC/
这篇关于; jquery:从当前屏幕位置开始动画动画,使页面向下移动100px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文