How to scroll the entire visible page to an anchor with a smooth effect (Scriptaculous or jQuery)?

I want to create anchored navigation. By clicking on the navigation link, the entire visible page should scroll down to the clicked anchor.

Most important is the following page structure.

--------------- (Begin visible browser area)
NAV1 nav2 nav3

content
--------------- (Begin/end visible browser area)
nav1 NAV2 nav3

content
--------------- (Begin/end visible browser area)
nav1 nav2 NAV3

content
--------------- (end visible browser area)

Finally, all the content is in one document, and the height of the current page (selected by the navigation element) must be calculated (using the JS library). I prefer PrototypeJS / Scriptaculous and jQuery.

The scroll effect should be a smooth slide / effect.

Chris

+3
source share
3 answers

jQuery, ScrollTo, , , , LocalScroll,

, , ( ) jQuery. "" .

+3

: Effect.ScrollTo

<a href="javascript:// scroll" onclick="Effect.ScrollTo('element_id', { duration:'.5'})" />link</a>
+1

Source: https://habr.com/ru/post/1745298/


All Articles