jquery滚动问题。如何自动滚动 onclick 到 div
只是想知道是否可以在单击时滚动到页面上的某个 div 位置。我似乎无法在互联网上找到任何记录此内容的地方。
我的想法是单击一个按钮,它会将您带到页面上该 div 的位置,可能通过 div ID 来实现。
问候,
泰勒
Just wondering if its possible to scroll to a certain div's position on a page onclick. I can't seem to find anywhere on the internet where this is documented.
My idea is to click a button, and it will take you to the position of that div on the page, possible by the div ID.
Regards,
Taylor
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我不确定您希望事件何时触发,所以这里是通用版本
如果您想要一个 id 为
myButton
的Im not sure when you want the event to fire so here is the generic version
If you want a
<button/>
with an id ofmyButton
that when clicked will cause you to scroll to a<div/>
with and id ofmyDiv
over the course of half a second:Using the jQuery ScrollTo plugin.