Scroll command
Smoothly scroll to an anchor or the top of the page.
Basic Usage (HTML)
data-jkit="[scroll:speed=slow;easing=easeOutBounce]"
Advanced Init (JavaScript)
$('#myelement').jKit('scroll', { 'speed': 'slow', 'easing': 'easeOutBounce' });
Options
Option | Values | Default | Description |
---|---|---|---|
speed | Int or “fast”, “slow” (Milliseconds) | 500 | The duration of the animation in milliseconds, bigger = slower. |
dynamic | “yes” or “no” | yes | Calculate the speed dynamically based on the distance? |
easing | String (“linear” or easing plugin option) | linear | The easing behavior of the animation |
offset | Int | 0 | Define an offset of where to scroll to, for example “-100” if you want some spacing above the anchor |
Events
Event | Description |
---|---|
clicked | Triggered whenever the scrolling starts |
complete | Triggered whenever the scrolling is completed |
Examples
Basic exmaples:
Two links, the first smoothly scrolls to the top, the second one to an anchor:
Source:
<a href="" data-jkit="[scroll]">To the top!</a> <a href="#anchor_options" data-jkit="[scroll:speed=1000;easing=easeOutBounce]">To the options anchor.</a>   <a href="#anchor_options" data-jkit="[scroll:speed=1000;easing=easeOutBounce;offset=-100]">100 pixels above the options anchor.</a>
Replacements
There are currently no replacements for this command.
[ Learn more about replacements ]
Discussions
Do you have questions or do you want to suggest new features? Than head over to our new community:
[ jKit Community ]