$(function(){ function ajax_rack_detail(rack_id){ $.post('/adv_label/store/ajax/ajax_get_rack_data-p.php', {ID :rack_id}, function(h){ $("#data_name").attr('class',h.TStore); $("#map").html(h.Google_Map); $("#rack_pic").attr('src',h.Pic_Path); $("#class_name").html(h.className); $("#data_name").html(h.Name); $("#address").html(h.Address); $("#tel").html(h.Tel); $("#open").html(h.Open); $("#rack_content").html(h.Content); $("#store_banner").trigger('destroy.owl.carousel'); $("#store_banner").html(h.Store_Img); $("div.news").html("").html(h.Rack_Detail); if(h.Rack_Detail){ $(".news-title").show(); }else{ $(".news-title").hide(); } if(h.Pic_Path){ $("#rack_pic").show(); } else{ $("#rack_pic").hide(); } // if(h.Pic_Path2){ // $("img.adpic").show().attr('src',h.Pic_Path2); // } // else{ // $("img.adpic").hide(); // } $(".store-banner").owlCarousel({ loop : true, items : 1, nav : true, navText : ['',''], dots:true, autoplay:true, navSpeed:1000, autoplayTimeout:8000, autoplaySpeed:1000, dotsSpeed:1000, }); }, 'json'); } $('.item').on('click', '.view_detail', function(event) { var rack_id = $(this).attr('rack_id'); ajax_rack_detail(rack_id); }); $(".store-banner").owlCarousel({ loop : true, items : 1, nav : true, navText : ['',''], dots:true, autoplay:true, navSpeed:1000, autoplayTimeout:8000, autoplaySpeed:1000, dotsSpeed:1000, }); $("#rack_class,#city_id,#rack_brand").on("change",function(){ $("#Search_Rack").submit(); }); // // ========================================================== // // 主選單開關 // // ========================================================== // $(".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'); } }); $('.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(); }); // ========================================================== // footer 跳窗 // ========================================================== $("#Main_Content").on('click','.Content_Button',function(){ $('.popupbg').addClass('is-show'); $('.popupbg').html($("#Content"+$(this).attr("sid")).html()); }); $("#Main_Content").on('click','.popupbg .close',function(){ $('.popupbg').removeClass('is-show'); $('.popupbg').removeAttr('style'); }); });