var initslider = function() { $('#img-slider li').bind({ reposition: function() { var degrees = $(this).data('roundabout').degrees, roundaboutbearing = $(this).parent().data('roundabout').bearing, rotatey = math.sin((roundaboutbearing - degrees) * (math.pi/180)) * 9; // $(this).css({ // "-webkit-transform": 'rotate(' + rotatey + 'deg)', // "-moz-transform": 'rotate(' + rotatey + 'deg)', // "-ms-transform": 'rotate(' + rotatey + 'deg)', // "-o-transform": 'rotate(' + rotatey + 'deg)', // "transform": 'rotate(' + rotatey + 'deg)' // }); } }); $('.jq_sliderprev').on('click', function(){ $('#img-slider').roundabout('animatetonextchild'); return false; }); $('.jq_slidernext').on('click', function(){ $('#img-slider').roundabout('animatetopreviouschild'); return false; }); $('body').on('keyup', function(e) { var keycode = e.which || e.keycode; if(keycode == 37) { $('#img-slider').roundabout('animatetopreviouschild'); e.preventdefault(); return false; } else if(keycode == 39) { $('#img-slider').roundabout('animatetonextchild'); e.preventdefault(); return false; } }); $('.jq_sliderswitch li').on('click', function() { var $elem = $(this); var index = $elem.index(); $('#img-slider').roundabout('animatetochild', index); return false; }); $('#img-slider').roundabout({ minscale: 0.4, maxscale: 0.9, duration: 750 }).bind({ animationend: function(e) { var index = $('#img-slider').roundabout('getchildinfocus'); $('.jq_sliderswitch li').removeclass('active'); $('.jq_sliderswitch li').eq(index).addclass('active'); } }); $('#text-slider').roundabout({ minopacity: 0, minscale: 1, // autoplay: false, // autoplayduration: 10000, // autoplaypauseonhover: true, duration: 1000 }).bind({ animationend: function(e) { var index = $('#text-slider').roundabout('getchildinfocus'); $('.jq_slidertextswitch li').removeclass('active'); $('.jq_slidertextswitch li').eq(index).addclass('active'); } }); $('.jq_slidertextprev').on('click', function(){ $('#text-slider').roundabout('animatetonextchild'); return false; }); $('.jq_slidertextnext').on('click', function(){ $('#text-slider').roundabout('animatetopreviouschild'); return false; }); $('.jq_slidertextswitch li').on('click', function() { var $elem = $(this); var index = $elem.index(); $('#text-slider').roundabout('animatetochild', index); return false; }); }; $(document).ready(function(){ initslider(); });