$(document).ready(function () { $(document).on('click','.email-popupbox',function(e){ if($(e.target).closest(".email-close").length || $(e.target).hasClass("email-popupbox")){ $('.email-popupbox').fadeOut(); } }); var n =0; // 首頁主廣告 var all = $("#slideshow .slide-item").length; if(all >= 1){ var vid = $("#slideshow .slide-item").find('video').get(0); // console.log($("#slideshow .slide-item").find('video')); if($("#slideshow .slide-item").find('video').length != 0){ $("#slideshow").owlCarousel({ items : 1, nav : true, navText : ['',''], }); vid.play(); }else{ $("#slideshow").owlCarousel({ loop : true, items : 1, nav : true, navText : ['',''], autoplay:true, autoplayTimeout:6000 }); } } function vidFade() { vid.classList.add("stopfade"); } function autoplay(){ var inall = $("#slideshow .slide-item").length; var now = $('#slideshow .active').index(); if(inall == now){ console.log(now); $("#slideshow").trigger('to.owl.carousel',[0,300]); setTimeout(autoplay,5000); }else{ console.log(now); $("#slideshow").trigger('next.owl.carousel',[300]); setTimeout(autoplay,5000); } } $("#slideshow").on('changed.owl.carousel', function(event) { var num = event.item.index; if($("#slideshow").find('video') && $("#slideshow").find('.owl-item').eq(num).find('video')){ } }) // 新品登場 $('#slide_new').owlCarousel({ // loop : true, // items : 5, margin: 28, responsive: { 0:{ items : 2, margin : 15, }, 660:{ items : 2, margin : 15, }, 768:{ items : 2, margin : 15, }, 960:{ items : 4 } }, lazyLoad: true, nav: true, navText: ['',''] }); setTimeout(function(){ $('#slide_new').fadeIn('slow',function(){ $(this).css({'opacity':1}); }); },1000) // 熱銷商品 $('.oneline-fiveitem-01 .wrapper').owlCarousel({ // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 768:{ items : 4 } }, nav : true, navText : ['',''] }); setTimeout(function(){ $('.oneline-fiveitem-01 .wrapper').fadeIn('slow',function(){ $(this).css({'opacity':1}); }); },1000) // 推薦商品 $('.tags-001 .wrapper').owlCarousel({ // loop : true, // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 768:{ items : 4 }, 1023:{ items : 5 } }, nav :true, // navText : ['',''] }); // 影音 $('.owl-video').owlCarousel({ loop: true, margin: 10, nav: true, responsive: { 0: { items: 1 }, 600: { items: 1 }, 1000: { items: 1 } } }) //首頁專題 $(".lookbook .picbox").owlCarousel({ loop : true, responsive:{ 0:{ items : 1 }, 480:{ items : 2 } }, nav : true, navText : ['',''], autoplay:true, autoplayTimeout:5000, }); //試用評價 $('.review-001 .warpper').owlCarousel({ // loop : true, // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 768:{ items : 4 } }, nav : true, navText : ['',''] }); // var owl =$('.picbox'); // $('.picbox').owlCarousel(); $('.picbox').on('translated.owl.carousel',function(event){ var id = $(this).find('.active').eq(0).find('.pic-item').attr('did'); ajax_topic_content(id); }); function ajax_topic_content(topic_id){ $.ajax({ url:"/module/ajax/ajax_get_topic_content-p.php", type:"POST", cache:false, async:false, dataType:"json", data:{ID:topic_id}, success:function(d){ $("#topic_content").html(d.Content); } }); } });