Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //rotation speed and timer
- var speed = 3000;
- var run = setInterval(rotate, speed);
- //a simple function to click next link
- //a timer will call this function, and the rotation will begin :)
- function rotate() {
- var awardSlides = document.getElementsByClassName('awardSlider'),
- slideInner = Array.prototype.slice.call( $( awardSlides ).find('.slideInner'), 0),
- slide = Array.prototype.slice.call( $( slideInner ).find('.award'), 0),
- width = slide[0].offsetWidth,
- left_value = width * (-1);
- if ($( awardSlides ).hasClass('is-active')) {
- //slide the item
- $( slideInner ).animate({'left': left_value}, 200, function () {
- var currentInner = Array.prototype.slice.call( $( this ));
- //move the first item and put it as last item
- $( this ).find('.award').last().after( $( this ).find('.award').first() );
- //set the default item to correct position
- $( slideInner ).css({'left': 0});
- });
- }
- //cancel the link behavior
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement