Skip to content

stevepiron/jquery-scroll-to

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

jQuery scroll to

A jQuery plugin that animates page jumps to anchors.

Default initialization

$('.js-scroll-to').spScrollTo();

Settings

Option Type Default Description
container jQuery object $('body') The containing element to scroll.
offset integer 0 Distance to the top of the viewport.
scrollSpeed integer 800 The duration of the scroll animation.
onBeforeScroll function undefined A function to be executed after reaching the target.

Initialization with custom settings

/**
 * 1. Remove 5px more from the cropped (calculated) height.
 */
$('.js-scroll-to').spScrollTo({
    container: $('html'),
    offset: $('#js-site-header').outerHeight()
});

Dependencies

jQuery

License

Copyright © Steve Piron

About

A jQuery plugin that animates page jumps to anchors.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published