$(function(){ $(document).on("click", ".activities-gotop", function(){ $("html,body").animate({scrollTop: 0},800); }) var breadcrumb_on =0; $('#breadcrumb .inline-block').on('click',function(){ if(breadcrumb_on==0){ $(this).addClass('on'); breadcrumb_on++; }else{ $(this).removeClass('on'); breadcrumb_on=0; } }); $(".owl-carousel").owlCarousel({ loop : true, items : 1, nav : true, }); if($("#picSlides .picItem").length>1){ $("#picSlides").owlCarousel({ loop : true, items : 1, nav : true, autoplay:true, autoplayTimeout:5000, }); } /*var clickbutton=0; $('.filter-button,.filterbox .close').on('click',function(){ clickbutton++; if(clickbutton==1){ $('.filterbox').css({'top':'10%'}); } if(clickbutton==2){ $('.filterbox').css({'top':'-100%'}); clickbutton=0; } });*/ var clickbutton=0; $('.filter-button,.filterbox .close').on('click',function(){ clickbutton++; if(clickbutton==1){ $('.filterbox').addClass('open'); } if(clickbutton==2){ $('.filterbox').removeClass('open'); clickbutton=0; } }); if($(".act1-product-list").length > 0){ const themeTarget = $('.act1-product-list') let wrapperStep = '' $(window).on('resize', function(e) { e.preventDefault() if($(this).width() >= 768 && wrapperStep !== 'desktop') { wrapperStep = 'desktop' } else if($(this).width() < 768 && wrapperStep !== 'mobile') { wrapperStep = 'mobile' } }).trigger('resize') $('#viewMode').on('click', '.btn-theme', function(e) { $(this).addClass('now').siblings('.btn-theme').removeClass('now') themeTarget.removeAttr('class').addClass('content').addClass('act1-product-list').addClass($(this).data('theme')) setTimeout(function(){ window.dispatchEvent(new Event('resize')) }, 100) }) }else{ $('#viewMode .view-three').on('click',function(){ $('#viewMode .view-three').addClass('now'); $('#viewMode .view-four').removeClass('now'); $('.content').removeClass('view-four').addClass('view-three hide-back'); setTimeout(function(){ $('.content').removeClass('hide-back'); },380); }); $('#viewMode .view-four').on('click',function(){ $('#viewMode .view-four').addClass('now'); $('#viewMode .view-three').removeClass('now'); $('.content').removeClass('view-three').addClass('view-four hide-back'); setTimeout(function(){ $('.content').removeClass('hide-back'); },380); }); } var owl6 = $(".user-list6 .orderSlide"); function owl6Carousel(){ if($(window).width() > 768){ owl6.owlCarousel({ responsive:{ 0:{ items : 2 }, 480:{ items : 3 }, 660:{ items : 4 }, 960:{ items : 5 }, 1023:{ items : 6 } }, nav : true, onRefresh : callback, }); }else{ owl6.trigger("destroy.owl.carousel") } } owl6Carousel() $(window).on("resize", owl6Carousel) var owl5 = $(".user-list5 .orderSlide"); owl5.owlCarousel({ responsive:{ 0:{ items : 2 }, 481:{ items : 3 }, 960:{ items : 4 }, 1023:{ items : 5 } }, nav : true, onRefresh : callback, }); var addowl = $(".userBox .addBox"); addowl.owlCarousel({ responsive:{ 0:{ items : 2 }, 481:{ items : 3 }, 661:{ items : 1 } }, nav : true, onRefresh : callback, }); function callback(event){ setTimeout(function(){ $('.hidebox').animate({'opacity':1}).removeClass('hidebox'); }, 300); } $('article > .content ').on('click','.button1',function(e){ let _this = $(this) $(window).one("activitiesOnStock", function(){ addPic() $(window).off("activitiesOutOfStock") }) $(window).one("activitiesOutOfStock", function(){ $(window).off("activitiesOnStock") }) function addPic(){ if(_this.attr("class").indexOf('add_to_cart') !=-1){ return false; } var img = _this.parents('.productBox'), img_src = img.find('img').eq(0).attr('src'), img_title = img.find('.title').html(), img_price = img.find('.font-big').html(), img_amount= img.find('.num-select').val(), add_array = new Array(); add_array[0] = 0; if(_this.parents('.content').attr('class').substring(11,13) == '02'){ var add_type = 2 }else{ var add_type = 1; } $(".delete[add_type="+add_type+"]").each(function(){ add_array.push(parseInt(_this.attr("del_id"))); }); let prodIndex = $("#max_prod_index").val(); var img_index = parseInt(prodIndex) ??Math.max.apply(null,add_array); // console.log(prodIndex) // console.log(img_index) var html = '