var page = (function() { var $grid = $( '.jjbox' ); return { init : function() { $grid.find( 'div.bb-bookblock' ).each( function( i ) { var $bookblock = $( this ), $nav = $bookblock.next().children( 'li' ), bb = $bookblock.bookblock( { speed : 600, shadows : false } ); // add navigation events $nav.each( function( i ) { $( this ).on( 'mouseover touchstart', function( event ) { var $dot = $( this ); $nav.removeclass( 'bb-current' ); $dot.addclass( 'bb-current' ); $bookblock.bookblock( 'jump', i + 1 ); return false; } ); } ); } ); } }; })(); page.init();