var popIndex=0; var popLength=1; $( document ).ready(function() { $('.popup-web').center(); $('.popup-web-close').on("click",function(){ $(this).parent().parent().parent().remove(); $('.popup-web').center(); popup_mobile(); }); $('.popup-web-day').on("click",function(){ $(this).parent().parent().parent().remove(); popup_mobile(); setCookie( $(this).attr("id"), "1" , 1); }); //ëª¨ë°”ì¼ í™”ë©´ì—ì„œ 맞추기 $(window).resize(function(){ popup_mobile(); }); popup_mobile(); }); function popup_mobile() { if($(window).width() <= widthXs) { popLength=$('.popup-web-in').length; if(popLength <= 1) { $('.popup-web-left').hide(); $('.popup-web-right').hide(); } $('.popup-web-in').each(function(idx){ if(idx > 0) { $(this).hide(); }else{ $(this).show(); } }); $('.popup-web-left').on("click",function(){ var popShow=0; popShow=(popIndex-1); if(popShow < 0) { popShow=(popLength-1); } popIndex=popShow; $('.popup-web-in').hide(); $('.popup-web-in:eq('+popShow+')').show(); console.log(popShow); }); $('.popup-web-right').on("click",function(){ var popShow=0; popShow=(popIndex+1); if(popShow >= popLength) { popShow=0; } popIndex=popShow; $('.popup-web-in').hide(); $('.popup-web-in:eq('+popShow+')').show(); console.log(popShow); }); } }