js main_slider
var $slide = $('.slide'), $slideGroup = $('.slide-group'), $bullet = $('.bullet');
var slidesTotal = ($slide.length - 1), current = 0, isAutoSliding = true;
$bullet.first().addClass('current');
var clickSlide = function() { //stop auto sliding window.clearInterval(autoSlide); isAutoSliding = false;
var slideIndex = $bullet.index($(this));
updateIndex(slideIndex); };
var updateIndex = function(currentSlide) { if(isAutoSliding) { if(current === slidesTotal) { current = 0; } else { current++; } } else { current = currentSlide; }
$bullet.removeClass('current'); $bullet.eq(current).addClass('current');
transition(current); };
var transition = function(slidePosition) { $slideGroup.animate({ 'top': '-' + slidePosition + '00%' }); };
$bullet.on( 'click', clickSlide); //$bullet.on( 'click', console.log('work')); if (typeof autoSlide !== 'undefined') { window.clearInterval(autoSlide); } var autoSlide = window.setInterval(updateIndex, 5000);