$(function(){ $('.user-orderBox').on('click','.delete',function(){ const del = $(this).parents('.orderProduct') const n = del.attr('data-group'); const na = del.attr('data-groupn'); const bg = `
${na+_jsLang.組}
${_jsLang.商品尚未選購}
` const classStr = `pic-bg num_${n}` del.find('.title').remove(); del.find('img').animate( { opacity:0 }, 300, function(){ del.html(bg).removeAttr('class style').addClass(classStr) } ); }); // $('.combosOuter .combosBox').each(function(i, ele) { // $(ele).owlCarousel({ // dots: false, // margin: 20, // responsive: { // 0:{ // items : 2 // }, // 450:{ // items : 3 // }, // 675:{ // items : 4 // }, // }, // nav: true, // navText: ['', ''], // }); // }) }); // ========================================================== // 商品展示區塊輪播、商品圖預覽功能、手機版放大功能、購物跳窗 // ========================================================== ;(function($) { if($('.moreview').children('.picitem').length > 3) { $('.moreview').owlCarousel({ margin: 5, dots: false, nav: true, navText: ['', ''], responsive: { 0: { items: 4 }, 576: { items: 5 }, 675: { items: 3 }, 768: { items: 4 }, 992: { items: 5 }, } }) } $(document).on('click', '.moreview .picitem', function(e) { e.preventDefault() let _this = $(this), moreview = _this.parents('.moreview'), idx = 0 if(moreview.hasClass('owl-carousel')){ idx = _this.parent('.owl-item').index() }else{ idx = _this.index() } //const thisTarget = _this.attr('data-target') moreview.find('.now').removeClass('now') _this.addClass('now') _this.parents('.product-detail').find('.item-box').eq(idx).addClass('now') .siblings('.item-box').removeClass('now') }) let previewStep = '' $(window).on('resize', function(e) { if($(this).width() >= 992 && previewStep !== 'desktop') { previewStep = 'desktop' // 預覽圖 hover 事件 $('.moreview').on('mouseenter', '.picitem', function(e) { e.preventDefault() let targetIndex = null if($(this).parent().hasClass('moreview')) { targetIndex = $(this).index() } else { targetIndex = $(this).parent('.owl-item').index() } $('.productImg').find('.item-box').eq(targetIndex).addClass('in-hover') .siblings('.item-box').removeClass('in-hover') }).on('mouseleave', function(e) { e.preventDefault() $('.productImg').find('.item-box').removeClass('in-hover') }) // 手機版放大圖 $('.productImg').off('click', '.item-box > a') $('body').off('click', '.zoomIn-wrapper') $('.zoomIn-wrapper').remove() $('body').removeClass('overflow-hidden') //購買跳窗 $(".selectPopupBox").removeClass('is-show'); $('body').off('click', '.selectbox-button'); } else if($(this).width() < 992 && previewStep !== 'mobile') { previewStep = 'mobile' // 預覽圖 hover 事件 $('.moreview').off('mouseenter', '.picitem') .off('mouseleave') // 手機版放大圖 $('.productImg').on('click', '.item-box > a', function(e) { e.preventDefault() const zoomTarget = $(this).attr('href') const zoomInDom = `