开发者

Hyperlink to a part of a page that doesn't have an identifier

开发者 https://www.devze.com 2023-03-13 06:55 出处:网络
I want to create a hyperlink that goes directly to the data parameter of the $.ajax command.But the closest hash tag that I can find is this one.

I want to create a hyperlink that goes directly to the data parameter of the $.ajax command. But the closest hash tag that I can find is this one.

Q: I开发者_Python百科s there a way to have the browser navigate down to a part where there is no id= or name= attribute? I'm thinking of maybe including some JavaScript into the url.


I recently did this for a project using jQuery and the jQuery ScrollTo plugin. It's quite simple.

1. Include the jQuery and jQuery ScrollTo libraries on your page

<script type="text/javscript"jquery.min.js" />
<script type="text/javascript" src="jquery.scrollTo-min.js" />

2. Ask jQuery to scroll to some part of the page. You can pass in any jQuery object (ie, and element, id selector etc). The second parameter is how long the scroll should take.

$.scrollTo($("#some_element_id_or_selector.with_a_class"), 1000);

In your description you've said there is no id on the element of interest, so try using other jQuery selectors. If you provide some more information about what you're trying to do I might be able to help more.

You can read more about the jQuery.scrollTo plugin here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号