UL Li smooth jump for horizontal rolling anchor points

Source: Internet
Author: User

The source code is:

Slide effect :

JQuery ("#topHeaderBlack"). Anmate ({scrollleft:jquery ("#" +nowflooruuid). Offset (). left},1000);
View Code

Topheaderblack is a div ID that contains the UL Li

jQuery ("#" +nowflooruuid) is the Li you need to anchor.

I am using the following code deformation to achieve the effect (after all, front slag, laughed at,)

$ ("Html,body"). Animate ({scrolltop:$ ("#box"). Offset (). top},1000)
View Code

The first thing to know about the use of the jquery animate method

Reference: http://www.w3school.com.cn/jquery/effect_animate.asp

Next jquery anchor jump and related operations (GO)


$ ("Html,body"). Animate ({scrolltop:$ ("#box"). Offset (). top},1000)
Reference: http://ygsilence.iteye.com/blog/1699906

The current project requirements are

<ul> has a lot of <li> and through the CSS is now the horizontal processing when Li too much when there will be rolling demand,

Then when you click on a <li> once again to enter the interface when you need to position the page to the <li> then you need an anchor point setting


The first method to use is the most primitive anchor point

That

1, location.href = "#firstAnchor"; Firstanchor is the anchor name.

2, Window.location.hash = Firstanchor; Firstanchor is the anchor name.

And, of course, the most primitive click events.

UL Li smooth jump for horizontal rolling anchor points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.