scrollTo:获取按钮图像到scrollTo div
我还没有找到真正适合我的情况的答案,我想这很常见。我正在寻找使用 jquery (或 javascript)将scrollTo 效果添加到我的网页。我仍然不知道什么是最简单的方法,因为我没有得到任何工作。 :(
我有一个垂直页面。导航位于每个 div 包装器的底部。我希望按钮区域滚动到 div。到目前为止,我已经设计了链接到 Div 的按钮样式。这非常完美,除了,我需要添加动画。
您可以在此处查看我的测试页面:我的网站
我尝试过scrollTo,但我的每个按钮都链接到一个特定的div,不知道如何修改该插件以适合我,
我认为下一个最佳解决方案是插入为窗口中的所有链接添加动画效果的javascript。知道在哪里可以找到该代码或如何针对我的情况修改它。
提前感谢大家,我期待着来自一个非常活跃的社区的解决方案。
I've not found an answer really specific to my case, which I would imagine is common. I'm looking to add the scrollTo effect to my webpage using jquery (or javascript). I still don't know what is the easiest way granted I've not gotten anything to work. :(
I have a single vertical page. Navigation is on the bottom of each div wrapper. I'd like my button areas to scroll to the divs. As of now, I've styled the buttons to link to the Divs. That's perfect, except, I need to add the animation.
You can have a look at my test page here: my site
I've tried scrollTo, but each of my buttons links to a specific div. Not sure how to modify the plugin to work for me.
I think the next best solution is inserting javascript that animates all links in a window? Definitely don't know where to find that code or how to modify it for my case.
Thanks in advance everyone, and I look forward to a solution from what seems to be a very vibrant community.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这样的事情...
工作示例: http://jsfiddle.net/BTncy/< /a>
Try something like this...
working example: http://jsfiddle.net/BTncy/
(注意,在您的示例中,您的 title 属性中有 javascript,而不是 onclick,不确定这是否是有意的)
这不使用插件,但您可以使用 jQuery 执行如下简单操作:
这允许您只需将选择器指定为您想要滚动到的内容,因此它可以很简单:
在我的快速测试中,这似乎有效。 (在我修复了scrollTo调用中目标元素的拼写错误之后)
(Note, from your example you have the javascript in the title attribute, not an onclick, not sure if that's intended)
This doesn't use a plugin, but you could do something as simple as the following using jQuery:
This allows you to just specify the selector to what you want to scroll to, so it could be as simple as:
In my quick testing that seemed to work. (After I fixed the typo of the target element in the scrollTo call)