Statistiques
| Révision :

root / tei / js / jquery.localscoll.init.js @ 2

Historique | Voir | Annoter | Télécharger (1,14 ko)

1
jQuery(function( $ ){
2
        /**
3
         * Most jQuery.localScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
4
         * @see http://flesler.demos.com/jquery/scrollTo/
5
         * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.LocalScroll.
6
         */
7
        
8
        // The default axis is 'y', but in this demo, I want to scroll both
9
        // You can modify any default like this
10
        $.localScroll.defaults.axis = 'xy';
11
        
12
        // Scroll initially if there's a hash (#something) in the url 
13
        $.localScroll.hash({
14
                target: '#content', // Could be a selector or a jQuery object too.
15
                queue:true,
16
                duration:1500
17
        });
18
        
19
        /**
20
         * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
21
         * also affect the >> and << links. I want every link in the page to scroll.
22
         */
23
        $.localScroll({
24
                target: '#content', // could be a selector or a jQuery object too.
25
                queue:true,
26
                duration:1000,
27
                hash:true,
28
                onBefore:function( e, anchor, $target ){
29
                        // The 'this' is the settings object, can be modified
30
                },
31
                onAfter:function( anchor, settings ){
32
                        // The 'this' contains the scrolled element (#content)
33
                }
34
        });
35
});