将页面滚动到< a>使用jQuery特定的href [英] Scroll the page to an <a> with a particular href with jQuery

查看:65
本文介绍了将页面滚动到< a>使用jQuery特定的href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户点击按钮时,我希望他的浏览器自动滚动到具有特定href的< a> (让我们称之为abc)。理想情况下,滚动会以某种方式很好地动画。

When the user clicks a button, I want his browser to automatically scroll to an <a> with a certain href (let's call it "abc"). Ideally the scrolling would be nicely animated in some way.

推荐答案

看一下 jQuery.scrollTo 插件。

使用该插件你可以简单地:

With that plugin you could simply:

$.scrollTo('a[href=abc]');

这篇关于将页面滚动到&lt; a&gt;使用jQuery特定的href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆