$(function(){ var _grid = $('.listbox').imagesLoaded(function(){ _grid.masonry({ itemSelector:'.item', gutter:0, }); }); function ajax_rack_detail(rack_id){ $.post('/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); $("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(); } }, '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:false, autoplay:true, navSpeed:1000, autoplayTimeout:8000, autoplaySpeed:1000, dotsSpeed:1000, }); var buxlidr_owl = $(".buxlidr-slides"); buxlidr_owl.owlCarousel({ loop : false, items : 1, nav: true, dots: false, navText: ['', ''], URLhashListener:true, startPosition:'URLHash', }); buxlidr_owl.on('changed.owl.carousel', function(event) { $('.buxlidr-menuitem').removeClass('now').eq(event.item.index).addClass('now'); }); $('#buxlidr').on('click','.buxlidr-right',function(event) { buxlidr_owl.trigger('next.owl.carousel'); }).on('click','.buxlidr-left',function(event) { buxlidr_owl.trigger('prev.owl.carousel'); }); $('.bouble').on('click',function(event) { $(this).addClass('now'); $('.single').removeClass('now'); $.ajax({ type:'POST', url:'/service/ajax/catalog-double.php', data:{ID:$("#Ebook_Data_ID").val()}, cache:false, error:function(d){ alert('網路連線過慢,網頁請重新整理'); }, success:function(d){ $('#buxlidr').html(d); var buxlidr_owl = $(".buxlidr-slides"); buxlidr_owl.owlCarousel({ loop : false, items : 1, nav : true, dots: false, navText: ['', ''], URLhashListener:true, startPosition:'URLHash', }); var buxlidr_nn = 0; buxlidr_owl.on('changed.owl.carousel', function(event) { $('.buxlidr-menuitem').removeClass('now').eq(event.item.index).addClass('now'); }); $('#buxlidr').on('click','.buxlidr-right',function(event) { buxlidr_owl.trigger('next.owl.carousel'); }).on('click','.buxlidr-left',function(event) { buxlidr_owl.trigger('prev.owl.carousel'); }); } }); }); $('.single').on('click',function(event) { $(this).addClass('now'); $('.bouble').removeClass('now'); $.ajax({ type:'POST', url:'/service/ajax/catalog-single.php', data:{ID:$("#Ebook_Data_ID").val()}, cache:false, error:function(d){ alert('網路連線過慢,網頁請重新整理'); }, success:function(d){ $('#buxlidr').html(d); var buxlidr_owl = $(".buxlidr-slides"); buxlidr_owl.owlCarousel({ loop : false, items : 1, nav : true, dots: false, navText: ['', ''], URLhashListener:true, startPosition:'URLHash', }); var buxlidr_nn = 0; buxlidr_owl.on('changed.owl.carousel', function(event) { $('.buxlidr-menuitem').removeClass('now').eq(event.item.index).addClass('now'); }); $('#buxlidr').on('click','.buxlidr-right',function(event) { buxlidr_owl.trigger('next.owl.carousel'); }).on('click','.buxlidr-left',function(event) { buxlidr_owl.trigger('prev.owl.carousel'); }); } }); }); });