jQuery Plugin For One Page Navigation Plugin - Page Scroll To ID

jQuery Plugin For One Page Navigation Plugin - Page Scroll To ID

Page Scroll To ID is a jQuery plugin to create anchor links which allow you to vertically and horizontally scroll to corresponding sections of your page with custom animations and easing effects. For each section there's a 'back to top' link and a 'next' link which allows to scroll to next section. Ideal for creating a trendy & pretty one page website layout. Check the demo pages in the zip for more advanced usages.

More Examples:

You might also like:

Basic Usage:

1. Create a set of anchor links with href attribute pointing to the corresponding ID of your sections.

<nav id="nav-menu">
<li><a href="#section-1">Section 1</a></li>
<li><a href="#section-2">Section 2</a></li>
<li><a href="#section-3">Section 3</a></li>

2. Create the main content.

<div id="content">
<section id="section-1">
<div class="content">
<h2>Section 1</h2>
Your Content Goes Here
<hr />
<a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> </div>
<section id="section-2">
<div class="content">
<h2>Section 2</h2>
Your Content Goes Here>
<hr />
<a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> </div>
<section id="section-3">
<div class="content">
<h2>Section 3</h2>
Your Content Goes Here
<hr />
<a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> </div>
<section id="section-xx">

3. Include jQuery library and jQuery Page Scroll To ID plugin at the end of your document.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
<script src="jquery.malihu.PageScroll2id.js"></script> 

4. Call the plugin.

$("#nav-menu a,a[href='#top'],a[rel='m_PageScroll2id']").mPageScroll2id({
highlightSelector:"#nav-menu a"
var to=$(this).parent().parent("section").next().attr("id");

5. All the default settings.

$("#nav-menu a,a[href='#top'],a[rel='m_PageScroll2id']").mPageScroll2id({
/* scroll animation speed in milliseconds: Integer */
/* auto-adjust animation speed (according to target element position and window scroll): Boolean */
/* scroll animation easing when page is idle: String */
/* scroll animation easing while page is scrolling: String */
/* end of page "smooth scrolling" (auto-adjust the scroll-to position when bottom elements are too short): Boolean */
page layout defines scrolling direction: String 
values: "vertical", "horizontal", "auto" 
/* extra space in pixels for the target element position: Integer */
/* highlight the main/default selectors or insert a different set: Boolean, String */
/* class of the clicked element: String */
/* class of the current target element: String */
/* class of the highlighted element: String */
/* force a single highlighted element each time: Boolean */
/* keep element highlighted until next (one element always stays highlighted): boolean */
/* highlight elements according to their target and next target position (useful when targets have zero dimensions). Non "auto" layouts only: boolean */
/* disable plugin below [x,y] screen size: boolean, integer, array ([x,y]) */
/* enable/disable click events for all selectors */
/* user callback functions: fn */
/* enable/disable the default selector: Boolean */
/* highlight elements now and in the future */
/* set specific live selector(s): String */


v1.5.9 (2018-10-01)

  • Plugin now works with anchors inside SVG elements.

v1.5.8 (2017-05-31)

  • Fixed a bug regarding links with URL in non-latin characters (e.g. Greek, Cyrillic etc.).

v1.5.7 (2017-02-09)

  • Fixed a bug regarding ps2id-speed-VALUE class.

v1.5.6 (2017-01-12)

  • webkit bug fixed (not scrolling when script is included in head tag)

v1.5.5 (2016-08-01)

v1.5.4 (2014-10-08)

  • update

v1.5.3 (2014-09-17)

  • update

v1.5.2 (2014-05-19)

  • update

v1.5.1 (2014-01-16)

  • Extended offset option, added offset data attribute, changed license to MIT.

This awesome jQuery plugin is developed by malihu. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 01.10.2018
  • Source