This repository was archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
[JS] Scroll
Sven Eberth edited this page Jul 26, 2017
·
1 revision
Scroll smoothly to an element
- $.fn.scrollTo - basic scroll function
- $.fn.scrollAnchor - define an element as scroll anchor
- data variation (HTML) - scroller in html
The basic function. Select the Target by an jQuery-Object
$( '.mytarget' ).scrollto({
speed: 1000,
easing: 'swing',
onScrollStart: function () {
alert( 'started scrolling' );
},
onScrollEnd: function () {
alert( 'finished scrolling' );
}
});
speed (int)
Optional. Duration of scrolling
Default: 1000
easing (string)
Optional. Scroll effect
Default: Swing
onScrollStart (function)
Optional. Callback function, called when scrolling starts
onScrollEnd (function)
Optional. Callback function, called when scrolling finished
Active smooth scroll by click on all links with <a href="#..."></a>
$( 'a[href^="#"]' ).scrollAnchor({
speed: 500
});
see Options of the basic function
<a data-scroll-target="#mytarget" data-scroll-speed="800" data-scroll-easing="linear"></a>
data-scroll-target (jquery/css selector)
The target scroll element
data-scroll-speed (int)
Optional. Duration of scrolling
data-scroll-easing (string)
Optional. Scroll effect
powered by
Mausbrand