本文介绍了jQuery:在页面上向下滚动设置增量(以像素为单位)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在单击元素时使页面从当前位置向下滚动150px.因此,可以说您大约向下滚动了一页.单击此链接,它将使您再滑下150个像素.
I'm trying to make a page scroll down 150px from the current position when an element is clicked. So lets say you're roughly halfway scrolled down a page. You click this link, and it will slide you down an additional 150 pixels.
使用jQuery是否可能?
Is this possible with jQuery?
我一直在寻找scrollTop和scrollTo插件,但似乎无法将点连接起来.
I've been looking at scrollTop and the scrollTo plugin, but I can't seem to connect the dots.
推荐答案
var y = $(window).scrollTop(); //your current y position on the page
$(window).scrollTop(y+150);
这篇关于jQuery:在页面上向下滚动设置增量(以像素为单位)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!