This is a jQuery plugin that provides some scroll controlling.
- highlighting scroll trigger/target elements
- general smooth scrolling.
- jQuery (jQuery 1.7 or later)
- http://likealunatic.jp/demo/jquery-scrollmanager/
- http://likealunatic.jp/demo/jquery-scrollmanager/index_vt.html
- http://likealunatic.jp/demo/jquery-scrollmanager/index_hr.html
Load this script after jquery.js, and call "scrollmanager" method when document is ready.
<script src="/js/jquery.js"></script>
<script src="/js/jquery.scrollmanager.js"></script>
<script>
$(function() {
$('a[href^="#"]').scrollmanager({
// some options...
horizontal: false
});
});
</script>
Selector must be "A" elements that has hash anchor to specific element id. Attribute selector (like this:'a[href^="#"]') is convenient to select such "A" elements.
Option name | Default value | Note |
---|---|---|
vertical | true | Whether controlling vertical scrolling or not. If you set this option to false, it'll be like this demo. |
horizontal | true | Whether controlling horizontal scrolling or not. If you set this option to false, it'll be like this demo. |
className | "on" | This will be added to the trigger/target elements to highlight. |
easing | "swing" | This will be passed to jQuery "animate()" method option. |
duration | 750 | This will be passed to jQuery "animate()" method option. |
delay | 500 | Delay of highlighting after scrolling. It's unit is millisecond. |
complete | function (target, trigger) { } | Callback function that will be called when highlighting. Two arguments, target element and trigger element will be passed. |
Detection of highlighting depends on the center position of screen. When the position comes in the target area, the target/the connected trigger will be highlighted.