Created
January 25, 2013 05:49
-
-
Save robinbastien/4632081 to your computer and use it in GitHub Desktop.
SlitSlider Initiation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var Page = (function() { | |
var $navArrows = $( '#nav-arrows' ), | |
$nav = $( '#nav-dots > span' ), | |
slitslider = $( '#slider' ).slitslider( { | |
onBeforeChange : function( slide, pos ) { | |
$nav.removeClass( 'nav-dot-current' ); | |
$nav.eq( pos ).addClass( 'nav-dot-current' ); | |
} | |
} ), | |
init = function() { | |
initEvents(); | |
}, | |
initEvents = function() { | |
// add navigation events | |
$navArrows.children( ':last' ).on( 'click', function() { | |
slitslider.next(); | |
return false; | |
} ); | |
$navArrows.children( ':first' ).on( 'click', function() { | |
slitslider.previous(); | |
return false; | |
} ); | |
$nav.each( function( i ) { | |
$( this ).on( 'click', function( event ) { | |
var $dot = $( this ); | |
if( !slitslider.isActive() ) { | |
$nav.removeClass( 'nav-dot-current' ); | |
$dot.addClass( 'nav-dot-current' ); | |
} | |
slitslider.jump( i + 1 ); | |
return false; | |
} ); | |
} ); | |
}; | |
return { init : init }; | |
})(); | |
Page.init(); | |
/** | |
* Notes: | |
* | |
* example how to add items: | |
*/ | |
/* | |
var $items = $('<div class="sl-slide sl-slide-color-2" data-orientation="horizontal" data-slice1-rotation="-5" data-slice2-rotation="10" data-slice1-scale="2" data-slice2-scale="1"><div class="sl-slide-inner bg-1"><div class="sl-deco" data-icon="t"></div><h2>some text</h2><blockquote><p>bla bla</p><cite>Margi Clarke</cite></blockquote></div></div>'); | |
// call the plugin's add method | |
ss.add($items); | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment