This time I will share jQuery Plugin and tutorial about Smooth Scrolling To Anchor Elements With jQuery – anchorLink, hope it will help you in programming stack.
Yet another jQuery based smooth scroll plugin for creating a configurable scroll animation when you switch between content sections with anchor links. It also supports scrolling to the desired point using URL hash when loading the webpage.
How to use it:
1. Include both jQuery library and the jquery.anchorlink.js
script at the bottom of the webpage.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< script src = "jquery.anchorlink.js" ></ script > |
2. Initialize the plugin and the anchorlink is ready for use.
1 |
$('a[href^="#"][href!="#"]').anchorlink(); |
3. Create a trigger element pointing to the desired point within the document.
1 |
< a href = "#header" >Back To Top</ a > |
4. Config the scroll animation with the following settings:
01 |
$( 'a[href^="#"][href!="#"]' ).anchorlink({ |
13 |
focusClass : 'js-focus' , |
17 |
afterScroll : function () {} |
This awesome jQuery plugin is developed by SpikeShape. For more Advanced Usages, please check the demo page or visit the official website.