Jquery scrollTo 仅以小增量向上滚动
我正在使用scrollTo插件滚动到一些标题。问题是它只会以小增量向上滚动,这是由浏览器窗口的高度决定的。它似乎无法识别我正在使用的 id。
点击此处查看页面,您需要滚动到页面底部并用两根手指选择项目。您需要手动向下滚动并单击右侧的链接才能看到上述行为(抱歉有点复杂)。
I am using the scrollTo plugin to scroll to some headings. The problem it will only scroll upwards in small increments that is determined by the height of the browser window. It does not seem to recognise the id's I am using.
Click here to view the page, you will need to scroll to the bottom of the page and select the item with two fingers. You need to manually scroll down and click on the links on the right to see the behavior mentioned above (sorry it's a bit complex).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
无需为此使用插件。
只需尝试下面的代码 -
No need to use plugin for this.
Just try below code -
我用这个小片段进行滚动
I use this little snippet for scolling
感谢你们两位的回答。我发现问题是我用CSS隐藏了名称标签的父div并用JS显示。这导致浏览器不知道如何找到名称标签(或类似的东西)。我从 CSS 中删除了 display:none ,瞧!
Thank you to both of you for your answers. I have worked out that the issue was I was hiding my parent div of the name tags with CSS and showing with JS. This was causing the browser to not know how to locate the name tags (or something like that). I removed the display:none from the CSS and voila!