$(document).ready(function(){ //for ¹®À¸·Î °¢ À̹ÌÁö ÁÂÇ¥¸¦ ¼³Á¤ (À̹ÌÁö Å©±â¿Í ¸¶Áø°ª) var imgWidth; var heightVal; base(); var auto = setInterval(autorun , 4000); var leftVal; window.onload=function(){ slideHeight(); }; $('.arrowRight').click(function(){//¿ÞÂÊ È­»ìÇ¥ Ŭ¸¯½Ã leftVal = imgWidth; $('.slides3 a').stop(true, true).animate({'left':"-="+leftVal},200,'swing',function(){ var left1 = parseInt( $(this).css('left') ); if( left1 < -imgWidth ) $(this).css('left', (imgWidth * ($(".slides3 a").length - 2)) + 'px'); }); }); $('.arrowLeft').click(function(){//¿À¸¥ÂÊ È­»ìÇ¥ Ŭ¸¯½Ã leftVal = imgWidth; $('.slides3 a').stop(true, true).animate({'left':"+="+leftVal},200,'swing',function(){ var left2 = parseInt( $(this).css('left') ); if( left2 > imgWidth*6 ) $(this).css('left', -imgWidth); }); }); function base(){ var flexWidth = $('.flexslider3').width(); imgWidth = flexWidth/6; $('.slides3 a').width(imgWidth); imgWidth += 2; for( var i = 0; i < $('.slides3 a').length; i++){ $('.slides3 a').eq(i).css("left",(i-1)*imgWidth); } }; function autorun(){ leftVal = imgWidth; $('.slides3 a').filter(':not(:animated)').animate({'left':"-="+imgWidth},200,'swing',function(){ var left1 = parseInt( $(this).css('left') ); if( left1 < -imgWidth ) $(this).css('left', (imgWidth * ($(".slides3 a").length - 2)) + 'px'); }); }; function slideHeight(){ heightVal = $('.slides3 a').height(); $('.flexslider3').height(heightVal); } $(window).resize(function(){ base(); slideHeight(); }); });