$(document).ready(function () { // 首頁主廣告 if($("#slideshow .slide-item").length>=1){ $("#slideshow").addClass('owl-carousel').owlCarousel({ loop : true, items : 1, nav : false, navText : ['',''], dots:true, autoplay:true, navSpeed:1000, autoplayTimeout:8000, autoplaySpeed:1000, dotsSpeed:1000, }); } // 首頁主廣告 if($(".slideshow-004").length!=0){ var AID = $(".today-wrapper").find(".slide-item").eq(0).attr("AID"); $("#Today_Title_Url").attr("href","/activities9/"+AID) $(".today-wrapper").addClass('owl-carousel').owlCarousel({ loop : false, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 1024:{ items : 1 } }, nav : false, navText : ['',''], dots:true, autoplay:true, navSpeed:1000, autoplayTimeout:8000, autoplaySpeed:1000, }); if(vid.length != 0){ $(vid).get(0).play(); } $(".today-wrapper").on('changed.owl.carousel',function(d){ var AID = $(".today-wrapper").find(".slide-item").eq(d.item.index).attr("AID"); $("#Today_Title_Url").attr("href","/activities9/"+AID) }); } function vidFade() { $(vid).get(0).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').addClass('owl-carousel').owlCarousel({ // loop : true, // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 1024:{ items : 5 } }, nav : true, navText : ['',''] }); setTimeout(function(){ $('#slide_new').fadeIn('slow',function(){ $(this).css({'opacity':1}); }); },1000) // 熱銷商品 $('.oneline-fiveitem-01 .wrapper').addClass('owl-carousel').owlCarousel({ // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 1024:{ items :5 } }, nav : true, navText : ['',''] }); setTimeout(function(){ $('.oneline-fiveitem-01 .wrapper').fadeIn('slow',function(){ $(this).css({'opacity':1}); }); },1000) // 推薦商品 $('.tags-001 .wrapper').addClass('owl-carousel').owlCarousel({ // loop : true, // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 768:{ items : 4 }, 1023:{ items : 5 } }, nav :true, navText : ['',''] }); // 影音 $('.video_002 .wrapper').addClass('owl-carousel').owlCarousel({ // loop : true, // items : 5, responsive:{ 0:{ items : 1 }, 660:{ items : 2 } }, nav : true, navText : ['',''] }); //首頁專題 $(".lookbook .picbox").addClass('owl-carousel').owlCarousel({ loop : true, responsive:{ 0:{ items : 1 }, 480:{ items : 2 } }, nav : true, navText : ['',''], autoplay:true, autoplayTimeout:5000, }); //試用評價 $('.review-001 .warpper').addClass('owl-carousel').owlCarousel({ // loop : true, // items : 5, responsive:{ 0:{ items : 2 }, 660:{ items : 3 }, 768:{ items : 4 } }, nav : true, navText : ['',''] }); // var owl =$('.picbox'); // $('.picbox').addClass('owl-carousel').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:"/gl/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); } }); } });