$(function() { $("#Main_Form").fromsAuth({ type:'NONE', }); $("#Member_Form").fromsAuth(); var header_height = 100; if($(window).width() <= 480){ header_height = 70; } $('.product-link').on('click',function(){ if($('#productbox').length!=0){ $("html,body").animate({scrollTop: $('#productbox').offset().top - header_height},800); }else{ $("html,body").animate({scrollTop: $('#productlist').offset().top - header_height},800); } }); $('.article-link').on('click',function(){ $("html,body").animate({scrollTop: $('#articlebox').offset().top - header_height},800); }); $('.shopcart-link').on('click',function(){ $("html,body").animate({scrollTop: $('#s1').offset().top - header_height},800); }); $("#Main_Content").on('click', '#step2', function() { var sh = $("#s2 .section-wrapper").height() + 100; $("html,body").animate({scrollTop: $('#s2').offset().top - sh}, 800); }); $("#Main_Content").on('click', '#step3', function() { var sh2 = $("#s3").height(); if($(window).width() <= 480){ $("html,body").animate({scrollTop: $('#s3').offset().top - 70}, 800); } else { $("html,body").animate({scrollTop: $('#s3').offset().top}, 800); } }); $("#Main_Content").on('click','.Content_Button',function(){ $('.popupbg').addClass('is-show'); $('.popupbg').html($("#Content"+$(this).attr("sid")).html()); }); if($(window).width()>769){ $("#Main_Content").on('click','#productlistbox .Pop_Prod_Data',function(){ if(!$(this).is('.button-cant')){ var $class = $(this).attr("class"), $id = $(this).attr("sid"), type = '1'; if($class == 'button-add') { type = '2'; } $('.popupbg').addClass('is-show'); $('.popupbg').attr("type",type); $('.popupbg').html($("#Data-"+$id).html()); $('.popupbg').find(".productView .moreview").owlCarousel({ loop:false, responsive:{ 0:{ items : 3, }, 572:{ items : 5, } }, nav : true, navText : ['',''] }).on('mouseleave','.owl-stage-outer', function() { var box = $(this).parents(".popupbg"); box.find(".productView .zoonbox").removeAttr('style'); }).on('click','.owl-item', function() { var now = $(this).index(), box = $(this).parents(".popupbg"); box.find(".productView .owl-item").not(this).find('.picitem').removeClass('now'); $(this).find('.picitem').addClass('now'); box.find(".productView .zoonbox").removeClass('now').eq(now).addClass('now'); }).on('mouseenter','.owl-item', function() { var now = $(this).index(), box = $(this).parents(".popupbg"); box.find(".productView .zoonbox").css('display','none').eq(now).css('display','flex'); }); } }); } if($(window).width()<769){ $("#Main_Content").on('click','#productlistbox .Pop_Prod_Data',function(){ if(!$(this).is('.button-cant')){ var $class = $(this).attr("class"), $id = $(this).attr("sid"), type = '1'; if($class == 'button-add') { type = '2'; } $('.popupbg').addClass('is-show'); $('.popupbg').attr("type",type); $('.popupbg').html($("#Prod_Data > #Data-"+$id).html()); $('.popupbg').find(".productView .productImg").owlCarousel({ loop:false, responsive:{ 0:{ items : 1, }, 768:{ items : 1, } }, nav : true, navText : ['',''] }); $('.moreview').remove(); } }); } $("#Main_Content").on('click','.informButton',function(){ $("#informID").val($(this).attr("sid")); $('.emailPopup').css('display','flex'); }); $("#Main_Content").on('click','.emailPopup .close',function(){ $('.emailPopup').css('display','none'); }); $("#Main_Content").on('click','.popupbg .close',function(){ $('.popupbg').removeClass('is-show'); $('.popupbg').removeAttr('style'); }); $("#Main_Content").on('click','.Content_Title',function(){ var num = $(this).attr("num"); $(this).parents(".popupbg").find(".Content_Title").css({"color":"#909090","border-top":"1px solid #e2e2e2"}); $(this).css({"color":"#000000","border-top":"1px solid #2f2f2f"}); $(this).parents(".popupbg").find(".Box1,.Box2,.Box3").hide(); $(this).parents(".popupbg").find(".Box"+num).show(); }); $("#Main_Content").on('click','.loginButton',function(){ $('.memberPopup').css('display','flex'); }); $("#Main_Content").on('click','.memberPopup .close',function(){ $('.memberPopup').css('display','none'); }); $("#Change_Pic").click(function(e){ $("#Checkspan").load('/ajax/ajax_get_check_pic.php',{change:1}); }); $("#Main_Content").on('focusin','.input-text',function(){ $(this).next('.text-title').addClass('now'); }); $("#Main_Content").on('focusout','.input-text',function(){ if($(this).val()==''){ $(this).next('.text-title').removeClass('now'); } }); $('.gotop').on('click',function(){ $("html,body").animate({scrollTop: 0},800); }); // $('.header-wrapper').on('click', '.menu-b', function(event) { // $(this).removeClass('menu-b').addClass('menu-b close'); // $(this).next('.header-aside').addClass('open'); // }); // $('.header-wrapper').on('click', '.close', function(event) { // $(this).removeClass('close').addClass('menu-b'); // $(this).next('.header-aside').removeClass('open'); // }); var _window = $(window); _window.on('scroll', function(event) { var scrollTop = _window.scrollTop(); if(scrollTop>0){ $(".gotop").css("opacity","1"); $("body").addClass('is-sticky'); // _body.css('padding-top',body_padding_s+'px'); }else{ $(".gotop").css("opacity","0"); $("body").removeClass('is-sticky'); // _body.css('padding-top',body_padding+'px'); } }); //時間倒數 var num = parseInt($("#CountDown_Box").attr("second"),10), _this = $("#CountDown_Box"); if(num > 0) { setInterval(function() { num--; if(num <= 0) { window.location.reload(); } var day = Math.floor(num/(3600*24)), hour = Math.floor((num - (day*3600*24) )/3600), min = Math.floor((num - (day*3600*24) - (hour*3600) )/60 ), second = num - (day*3600*24) - (hour*3600) - (min*60), pad = '00'; if(day > 0) { _this.find(".timer").eq(0).html(day); _this.find(".timer").eq(1).html(pad.substring(hour.toString().length)+hour); _this.find(".timer").eq(2).html(pad.substring(min.toString().length)+min); _this.find(".timer").eq(3).html(pad.substring(second.toString().length)+second); } else { _this.find(".Date_Box").remove(); _this.find(".timerbox").html(_this.find(".timerbox").html().replace('天','')); _this.find(".timer").eq(0).html(pad.substring(hour.toString().length)+hour); _this.find(".timer").eq(1).html(pad.substring(min.toString().length)+min); _this.find(".timer").eq(2).html(pad.substring(second.toString().length)+second); } },1000); } $("#Main_Content").on("click",".table-button",function(){ $(".table-button").removeClass('now'); $(this).addClass('now'); var type=$(this).data('type'); $(".tableBox").hide(); $("#Box-"+type).show(); $(".wear_report").show(); }); $("#Main_Content").on("click",".table-button1",function(){ $(".table-button1").removeClass('now'); $(this).addClass('now'); var type=$(this).data('type'); $(".tableBox1").hide(); $("#Box1-"+type).show(); $(".wear_report").show(); }); }); //刪除購物車 $("#Main_Content").on('click','.product-del',function() { $.ajax({ url:"/iwoman/ajax/ajax_del_cart.php", type:"POST", cache:false, data:{ID:$(this).attr("sid"), Page_Shop_ID:$("#Page_Shop_ID").val()}, error:function(d){ alert('網路連線過慢,網頁請重新整理'); }, success:function(d){ var d = d.trim(); switch(d){ case "RET_SUCCESS": updatePage('&action=del'); break; case "RET_NO_MEMBER_NO": alert(_jsLang.欲購買紅利兌換商品請先登入會員並完成會員認證); break; case "RET_RBONUS_OUT": alert(_jsLang.紅利不足); break; case "RET_ERROR": alert(_jsLang.資料庫忙線中); break; case "RET_PROD_ERROR": alert(_jsLang商品已下架); break; case "RET_NO_PROD": alert(_jsLang.請選擇商品); break; case "RET_STOCK_ERROR": alert(_jsLang.商品庫存不足); break; case "RET_LIMIT_ERROR": alert(_jsLang.數量超過限購量); break; default: alert(_jsLang.資料庫忙線中); break; }; } }); setTimeout(function () { $('.emptyCartPrompt').fadeOut() }, 5000) }); //修改數量 $("#Main_Content").on('click','.Prod_Plus',function(){ var Amount = parseInt($(this).prev(".Prod_Amount").val())+1, Stock = parseInt($(this).attr("max")); if(Amount > 100 || Amount > Stock) { return false; } $(this).prev(".Prod_Amount").val(Amount).change(); }); $("#Main_Content").on('click','.Prod_Minus',function(){ var Amount = parseInt($(this).next(".Prod_Amount").val())-1; if(Amount < 1) { return false; } $(this).next(".Prod_Amount").val(Amount).change(); }); $("#Main_Content").on('change','.Prod_Amount',function(){ var ID = $(this).parents(".listbox-item").find(".product-del").attr("sid"), Amount = $(this).val(); if(Amount > 100) { Amount = 100; } if(Amount < 1) { Amount = 1; } $.ajax({ url:"/iwoman/ajax/ajax_change_cart.php", type:"POST", cache:false, data:{ID:ID,Amount:Amount,Page_Shop_ID:$("#Page_Shop_ID").val()}, error:function(d){ alert('網路連線過慢,網頁請重新整理'); }, success:function(d){ var d = d.trim(); switch(d){ case "RET_SUCCESS": updatePage(); break; case "RET_NO_MEMBER_NO": alert(_jsLang.欲購買紅利兌換商品請先登入會員並完成會員認證); break; case "RET_RBONUS_OUT": alert(_jsLang.紅利不足); break; case "RET_ERROR": alert(_jsLang.資料庫忙線中); break; case "RET_PROD_ERROR": alert(_jsLang商品已下架); break; case "RET_NO_PROD": alert(_jsLang.請選擇商品); break; case "RET_STOCK_ERROR": alert(_jsLang.商品庫存不足); break; case "RET_LIMIT_ERROR": alert(_jsLang.數量超過限購量); break; default: alert(_jsLang.資料庫忙線中); break; }; } }); }); //活動字串 $("#Main_Content").on('click','#Act_Str_Button',function(){ var str = $("#Act_Str_Input").val(); if(str) { updatePage('&Act_Str='+str); } }); $("#Main_Content").on('click','#Act_Str_Cancel',function(){ updatePage('&Act_Str=Cancel_Act_Str'); }); //切換配送國家 $("#Main_Content").on('change','#Send_Country',function(){ updatePage('&Country='+$(this).val()); }); //切換配送方式 $("#Main_Content").on('click','input[name="Ship_Type"]',function(){ updatePage('&Ship_Type='+$(this).val()); }); //切換付款方式 $("#Main_Content").on('click','input[name="Pay_Type"]',function(){ updatePage('&Pay_Type='+$(this).val()); }); //切換配送城市 $("#Main_Content").on('change','#Send_City',function(){ updatePage('&City='+$(this).val()); }); //切換配送地區 $("#Main_Content").on('change','#Send_Area',function(){ updatePage('&Area='+$(this).val()); }); //選擇門市 $("#Main_Content").on("click","#Choose_Store", function(){ var $return = encodeURIComponent('kol/'+$("#Page_Shop_IDAs").val()+'/#shopcartbox'), $type = $(this).attr("type"), $coll = $(this).attr("coll"); updatePage('&save=1'); setTimeout(function(){ window.location.href = '/shopcart/e_returns/emap-p.php?url='+$return+'&type='+$type+'&coll='+$coll; },500); }); //送出訂單 $("#Main_Content").on('click','#Form_Submit',function(){ $("#Main_Form").submit(); // $('.cart-complete').addClass('in-active');// 開啟結帳完成視窗 // $('body').addClass('in-sticky');// 視窗鎖定 }); // 關閉結帳完成視窗 $('.js-close').on('click', function(e) { $('.cart-complete').removeClass('in-active'); $('body').removeClass('in-sticky'); }) //姓名、電話、Email、地址、備註 $("#Main_Content").on('change','#Send_Name,#Send_Cellphone,#Email,#Send_Address,#Send_Memo',function(){ updatePage('&save=1'); }); //自動加入會員、收貨時間 $("#Main_Content").on('click',"#Auto_Add,input[name='Send_Time']",function(){ updatePage('&save=1'); }); //切換載具類型 $("#Main_Content").on('change',"#CarrierType",function(){ updatePage(); }); //切換發票類型 $("#Main_Content").on('click',"input[name='Invo_Mod']",function(){ updatePage(); }); //同收件地址 $("#Main_Content").on('click','#Invo_Same_Button',function(){ if($(this).prop("checked")) { var same = '1'; $("#Invo_Address_Box").hide(); $("#Invo_Address").attr("fun",""); } else { var same = '2'; $("#Invo_Address_Box").show(); $("#Invo_Address").attr("fun","checkNull"); } updatePage('&Invo_Same='+same+'&save=1'); $("input[name='Invo_Same']").val(same); }); $("#Main_Content").on('click','.title-big',function(){ $(this).parent('section').toggleClass("open",500); }); $("#Main_Content").on('click','.shopcart-link',function(){ $('section').addClass("open",500); }); $('body').on('click','.arrow .title-big', function(event) { // console.log($('.is-nowStep')); if(!$(this).is('.open')){ $('section').not(this).removeClass('open'); $(this).parent('section').addClass('open'); updatePage('&Step='+$(this).parent('section').attr("id").substr(1,1)+'&save=1'); } }); $("#Main_Content").on('click','#step2',function(){ $('#s2').addClass("open",500); $('#s2').addClass("arrow",500); //$(this).parents('.section-wrapper').parent('section').removeClass('open'); updatePage('&Step=2&save=1&MoneyShow=1'); }); $("#Main_Content").on('click','#step3',function(){ $('#s3').addClass("open",500); $('#s3').addClass("arrow",500); //$(this).parents('section').removeClass('open'); updatePage('&Step=3&save=1'); }); //門市國家 $("#Main_Content").on('change','#store_country',function(){ var country = $(this).val(); if(country <= 0) { country = 'none'; } updatePage('&store_country='+country); }); //門市區域 $("#Main_Content").on('change','#store_area',function(){ var area = $(this).val(); if(area <= 0) { area = 'none'; } updatePage('&store_area='+area); }); //門市搜尋 $("#Main_Content").on('click','#searchBtn',function(){ updatePage('&store_search=1'); }); //門市按鈕 $("#Main_Content").on('click','.storeBtn',function(){ if($(this).hasClass("active")) { return false; } updatePage('&Store_ID='+$(this).attr("sid")); }); //推薦門市國家 $("#Main_Content").on('change','#Recommender_country',function(){ var rec_country = $(this).val(); if(rec_country <= 0) { rec_country = 'none'; } updatePage('&Recommender_country='+rec_country); }); //推薦門市區域 $("#Main_Content").on('change','#Recommender_area',function(){ var rec_area = $(this).val(); if(rec_area <= 0) { rec_area = 'none'; } updatePage('&Recommender_area='+rec_area); }); //推薦門市 $("#Main_Content").on('change','#Recommender_Store',function(){ var rec_store = $(this).val(); if(rec_store <= 0) { rec_store = 'none'; } updatePage('&Recommender_Store='+rec_store); }); // 按下我要結帳後出現底部浮動 $("#Main_Content").on('click', '#step2', function() { $('.moneyPrompt').css('display', 'flex').hide().fadeIn() }); //使用禮券 $("#Main_Content").on("click",".gift-sent,.gift-jump",function(){ var usable = ''; $(".Choose_Usable:checked").each(function(){ usable += $(this).val()+','; }); updatePage('&Usable='+usable); }); //取消使用禮券 $("#Main_Content").on('click','.Usable_Cancel',function(){ updatePage('&Cancel_Usable='+$(this).attr("sid")); }); function updatePage(data) { //取得一般配送資料 var send = ''; var data = data || ''; //寄送資料 $("#Send_Name,#Send_Cellphone,#Email,#Send_Address,input[name='Send_Time']:checked,#Send_Memo,#Del_Type,#Auto_Add:checked").each(function(){ send += '&'+$(this).attr("name")+'='+$(this).val(); }); //發票資料 $("input[name='Invo_Mod']:checked,#CarrierType,#CarrierId1,#CarrierId2,#NPOBAN,#Invo_Title,#Invo_No,#Invo_Address").each(function(){ send += '&'+$(this).attr("name")+'='+$(this).val(); }); var $data = 'type=update'+data+send+'&Page_Shop_ID='+$("#Page_Shop_ID").val(); $.ajax({ url:"/iwoman/ajax/ajax_get_cart.php", type:"POST", async: true, data:$data, cache:false, error:function(d,e,f){ alert('網路連線過慢,網頁請重新整理'); }, success:function(d){ $('body').css('overflow','auto'); if(d) { $("#Ajax_Box").html(d); //活動字串訊息 if($("#Coupon_Msg").val()){ alert($("#Coupon_Msg").val()); } $("#Main_Form").fromsAuth({ type:'NONE' }); //加購按鈕 var add = parseInt($("#CanAdd").val()); if(add > 0) { $(".Add_Button").removeClass('button-cant'); $(".Add_Button").html('加購'); } else { $(".Add_Button").addClass('button-cant'); $(".Add_Button").html('未符合加購'); } //滿額按鈕 var gift = parseInt($("#CanGift").val()); if(gift > 0) { $(".Gift_Button").removeClass('button-cant'); $(".Gift_Button").html('挑選'); } else { $(".Gift_Button").addClass('button-cant'); $(".Gift_Button").html('未符合滿額贈品挑選'); } var amount = parseInt($("#ChooseGift").val()); $("#Gift_Amount").html(amount); } } }) } $("#Main_Content").on("click",".add_to_cart",function(){ $('.successPopupMask').css('display','flex').fadeIn() $('.successPopup').fadeIn() setTimeout(function () { $('.successPopupMask').fadeOut() $('.successPopup').fadeOut() }, 1100) }); $("#Main_Content").on("click",".selectPopupBox-buttonbox",function(){ $('.popupbg').removeClass('is-show'); }); //禮券開關 $("#Main_Content").on("click",".gift-jump,.gift-button,.loginButton",function(){ $('.gift-content,.gift-jump').removeClass('is-show'); $('body').removeAttr('style'); }); $("#Main_Content").on("click",".gift",function(){ //未登入 if($(this).hasClass('loginButton')) { return false; } $('.gift-content,.gift-jump').addClass('is-show'); $('body').css('overflow','hidden'); }); // ========================================================== // 主選單開關 // ========================================================== $(".menu-b,.nav-bg").click(function(){ $(".header-01").toggleClass("open-nav"); $(".navBox").toggleClass("open-nav"); $('body').toggleClass('in-sticky') $('.menu-b').toggleClass('close'); }); $('#menu-nav').on('click','.item-title',function(){ var n = $(this).parent(".open").length; var t = $(this).attr("type"); if(t==''){ $('#menu-nav .nav-item').removeClass('open'); $('#menu-nav .menu-item').removeClass('open-sub'); $(".subitembox").removeClass('open-sub'); if(n == 0){ $(this).parent(".nav-item").addClass('open'); } }else{ $('#menu-nav .nav-item').removeClass('open'); $('#menu-nav .menu-item').removeClass('open-sub'); $(".subitembox").removeClass('open-sub'); if(n == 0){ $("#subitembox"+t).addClass('open-sub'); $(this).parent(".nav-item").addClass('open'); } } }).on(' click','.subtitle',function(){ var n = $(this).parent(".open-sub").length; $('#menu-nav .menu-item').removeClass('open-sub'); if(n == 0){ $(this).parent(".menu-item").addClass('open-sub'); } }); // ========================================================== // 穿搭視窗開關 // ========================================================== ;(function($) { function log(obj) { console.log(obj) } let modalStep = 0 function modalCheck(step, jqElement) { if(step) { jqElement.addClass('in-active') $('body').addClass('overflow-hidden') } else { jqElement.removeClass('in-active') $('body').removeClass('overflow-hidden') } } $('.blockbox').on('click', '.modal-toggle', function(e) { const target = $(this).data('target') modalStep = 1 modalCheck(modalStep, $(target)) }) $('.modal-wrapper').on('click', function(e) { if (e.currentTarget === e.target || e.target === $('.modal-closer')[0]) { modalStep = 0 modalCheck(modalStep, $(this)) } }) })($) // ========================================================== // 穿搭輪播 // ========================================================== ;(function($) { function log(obj) { console.log(obj) } function writeIndex() { const itemTotal = $(this).find('.owl-dot').length const itemNow = $(this).find('.owl-dot.active').index() $(this).parents('.boxtype-15').find('.slide-page').text(`${itemNow + 1} / ${itemTotal}`) } function slideInit(jqElement, items) { if (jqElement.data('owl.carousel')) { jqElement.data('owl.carousel').destroy() } if (jqElement.children().length > items) { jqElement.owlCarousel({ items: items, center: true, loop: true, nav:true, margin: 16, dots: true, // autoplay: true, autoplayHoverPause: true, autoplayTimeout: 5000, }) .on('changed.owl.carousel', writeIndex) .on('refreshed.owl.carousel', writeIndex) jqElement.trigger('refresh.owl.carousel') } } const owl = $('.boxtype-15 .floatBox') let owlDevice = '' $(window).on('resize', function(e) { if(owlDevice !== 'mobile' && $(window).width() < 768) { owlDevice = 'mobile' owl.each(function(i, item) { const slide = $(item) slideInit(slide, 1) }); } else if(owlDevice !== 'desktop' && $(window).width() >= 768) { owlDevice = 'desktop' owl.each(function(i, item) { const slide = $(item) slideInit(slide, 2) }); } }) $(window).trigger('resize') })($) $('.open-search').on('click',function(){ $('form.search').addClass('show'); $('.search input').focus(); }); $('.search.show-480').on('click',function(){ $(this).toggleClass('m-open'); }); $('.language_t').on('click',function(){ $(this).toggleClass('open'); }); // 只打開一個 $('.nav-list').on('click','.nav-list-item',function(){ var n = $(this).parent(".open").length; $('.nav-list .nav-list-item').removeClass('open'); $('.nav-list .nav-list-item').removeClass('open-sub'); if(n == 0){ $(this).addClass('open'); } }).on(' click','.subtitle',function(){ var n = $(this).parent(".open-sub").length; $('.subtitle').removeClass('open-sub'); if(n == 0){ $(this).addClass('open-sub'); } }); $('footer').on('click','.Weishin_Qrcode',function(){ $('.qr-popBox').show(); }); $('footer').on('click','.pop-content .close',function(){ $('.qr-popBox').hide(); }); $(".pin-target").on("click",function(){ var pid = $(this).attr("pid"); var pin = $(this).attr("pin"); $("#pinWrapper").find(".modal-content").hide(); $("#pinWrapper").find(".pin_show"+pid+"_"+pin).show(); }); // ========================================================== // 穿搭圖跳窗內slider // ========================================================== (function ($) { $('.modal-content').each(function(i, ele) { const item = $(ele).find('.flat-slide-item'); const itemAmount = item.length; let flatSlideStep = 0; let startPointX = 0; let endPointX = 0; function slideCheck(wrapperName, step, amount) { // 當前顯示圖片 item.eq(step).addClass('in-active').siblings('.flat-slide-item').removeClass('in-active'); // 前一張圖片動畫 if (step) { item.eq(step - 1).addClass('flat-slide-prev').siblings('.flat-slide-item').removeClass('flat-slide-prev'); } else { item.eq(amount - 1).addClass('flat-slide-prev').siblings('.flat-slide-item').removeClass('flat-slide-prev'); } // 對應 dot 樣式調整 $(wrapperName).find('.flat-dot').eq(step).addClass('in-active').siblings('.flat-dot').removeClass('in-active'); } function slideInit() { slideCheck(ele, flatSlideStep, itemAmount); } function slidePrev() { flatSlideStep = (flatSlideStep - 1 + itemAmount) % itemAmount; slideCheck(ele, flatSlideStep, itemAmount); } function slideNext() { flatSlideStep = (flatSlideStep + 1) % itemAmount; slideCheck(ele, flatSlideStep, itemAmount); } // prev next slide 切換 $(ele).on('click', '.flat-prev', function (e) { slidePrev(); }).on('click', '.flat-next', function (e) { slideNext(); }); // clickMove slide 切換 $(ele).on('mousedown', '.flat-slide-item', function (e) { startPointX = e.clientX; }).on('mouseup', '.flat-slide-item', function (e) { endPointX = e.clientX; if (endPointX < startPointX) { slideNext(); } else if (endPointX > startPointX) { slidePrev(); } }); // touchMove slide 切換 $(ele).on('touchstart', '.flat-slide-item', function (e) { const itemTouch = e.originalEvent.touches[0]; startPointX = itemTouch.clientX; }).on('touchend', '.flat-slide-item', function (e) { const itemTouch = e.originalEvent.changedTouches[0]; endPointX = itemTouch.clientX; if (endPointX < startPointX) { slideNext(); } else if (endPointX > startPointX) { slidePrev(); } }); // dots 對應 slide 切換 $(ele).on('click', '.flat-dot', function (e) { const itemIndex = $(this).index(); slideCheck(ele, itemIndex, itemAmount); }); // slide 初始化 slideInit(); }); })($); // ;(function($) { // const modalSlider = $(".product-preview") // modalSlider.each(function(i, item) { // $(item).owlCarousel({ // loop:true, // nav:true, // items:1, // startPosition: 'URLHash', // slideBy: 'page', // }) // $(item).trigger('refresh.owl.carousel') // $(item).on('refreshed.owl.carousel', function(e) { // const itemIndex = $(this).find('.owl-dot.active').index() // const clickGroup = $(this).next('.product-detail').find('.product-color-item') // clickGroup.eq(itemIndex).addClass('in-active').siblings().removeClass('in-active') // }) // $(item).on('translated.owl.carousel', function(e) { // const itemIndex = $(this).find('.owl-dot.active').index() // const clickGroup = $(this).next('.product-detail').find('.product-color-item') // clickGroup.eq(itemIndex).addClass('in-active').siblings().removeClass('in-active') // }) // }); // })($) $('.modal-closer').on("click",function(){ $(".modal-wrapper").removeClass('in-active'); $('body').removeClass('overflow-hidden'); }); var vid = $("#slideshow .slide-item").find('video'); // 紅眼廣告 if($(".slideshow .slide-item").length>=1){ $(".slideshow").owlCarousel({ loop : true, items : 1, nav : false, navText : ['',''], dots:true, autoplay:true, navSpeed:1000, autoplayTimeout:8000, autoplaySpeed:1000, dotsSpeed:1000, }); if(vid.length != 0){ $(vid).get(0).play(); } }