Skip to content Skip to sidebar Skip to footer

JQuery SerialScroll: Add Class To Active Item

I'm using Ariel Flesler's serialScroll script and would like to add a class to the active, or highlighted item so I can style it with CSS. Reading the documentation I discovered th

Solution 1:

From the plugin example page, here's how onBefore is being used:

onBefore:function( e, elem, $pane, $items, pos ){
    /**
    * 'this' is the triggered element 
    * e is the event object
    * elem is the element we'll be scrolling to
    * $pane is the element being scrolled
    * $items is the items collection at this moment
    * pos is the position of elem in the collection
    * if it returns false, the event will be ignored
    */
    //those arguments with a $ are jqueryfied, elem isn't.
}

in that function, you can add your active class, and use the onAfter function to remove the class from the previous element.


Post a Comment for "JQuery SerialScroll: Add Class To Active Item"