$(function(){ var cT = 2000, sT = 3000; var index = 0, $img = $('.slide_main').children('.slide'), imgLen = $img.length; $img.not(':first').css('opacity','0'); for (var i=0; i'); } var $tN = $('.slick-dots li'); $tN.first().addClass('active'); $tN.click(function(){ $img.stop(); clearInterval(slides); $(this).addClass('active').siblings().removeClass('active'); var number = $(this).index(), $choiceImg = $img.eq(number); index = (number) % imgLen; $choiceImg.siblings().animate({opacity:0},cT); $choiceImg.animate({opacity:1},cT); start(); }); function start(){ slides = setInterval(function(){ var next = (index +1) % imgLen; $tN.removeClass('active').eq(next).addClass('active'); $img.eq(index).animate({opacity:0},cT); $img.eq(next).animate({opacity:1},cT); index = next; },sT + cT); }; start(); }); $(function(){ var cT = 2000, sT = 3000; var index = 0, $img = $('.box_slide').children('.slide'), imgLen = $img.length; $img.not(':first').css('opacity','0'); for (var i=0; i'); } var $tN = $('.slick-dots02 li'); $tN.first().addClass('active'); $tN.click(function(){ $img.stop(); clearInterval(slides); $(this).addClass('active').siblings().removeClass('active'); var number = $(this).index(), $choiceImg = $img.eq(number); index = (number) % imgLen; $choiceImg.siblings().animate({opacity:0},cT); $choiceImg.animate({opacity:1},cT); start(); }); function start(){ slides = setInterval(function(){ var next = (index +1) % imgLen; $tN.removeClass('active').eq(next).addClass('active'); $img.eq(index).animate({opacity:0},cT); $img.eq(next).animate({opacity:1},cT); index = next; },sT + cT); }; start(); });