// ========================================================== // 列表上方廣告banner輪播 // ========================================================== ;(function($) { if($('.picSlides-big').length) { $('.picSlides-big').each(function(i, ele) { if($(ele).children().length > 1) { $(ele).owlCarousel({ autoplay: true, autoplayHoverPause: true, autoplaySpeed: 1500, autoplayTimeout: 5000, dots: false, items: 1, loop: true, margin: 10, nav: true, navText: ['', ''], }) } }) } })($) // ========================================================== // 手機版篩選器 // ========================================================== ;(function($) { $('.column-layout').on('click', '.function-button', function(e) { e.preventDefault() $(this).parents('.function-item').toggleClass('in-active') .siblings('.function-item').removeClass('in-active') const thiaTarget = $(this).attr('data-target') $(thiaTarget).toggleClass('in-active') .siblings('.aside-panel').removeClass('in-active') }) })($) // ========================================================== // 排序展開 // ========================================================== ;(function($) { $(document).on("click", ".dropdown-btn", function(){ let box = $(this).parents(".select-dropdown") if(box.hasClass("in-open")){ box.removeClass("in-open") $(document).off("click.closeDropdown") }else{ box.addClass("in-open") $(document).on("click.closeDropdown", function(e){ let target = $(e.target) if(target.closest(".select-dropdown").length <= 0){ box.removeClass("in-open") $(document).off("click.closeDropdown") } }) } }) $(document).on("click", ".dropdown-item", function(){ let _this = $(this) let target = _this.parents(".select-dropdown").data("target") if(_this.hasClass("selected")){ $(target).val("").trigger("change") _this.removeClass("selected") }else{ $(target).val(_this.data("value")).trigger("change") _this.siblings().removeClass("selected") _this.addClass("selected") } }) })($) // ========================================================== // 手機側欄 // ========================================================== ;(function($) { $(document).on("click", ".panel-toggle", function(){ let _this = $(this) let panel = $(_this.data("panel")) if(panel.length){ if(panel.hasClass("in-active")){ $(panel).removeClass("in-active") $("body").removeClass("overflow-hidden") }else{ $(panel).addClass("in-active") if($(window).width() < 1200){ $("body").addClass("overflow-hidden") } } } }) $(document).on("click", ".aside-panel", function(e){ if($(e.target).hasClass("aside-panel") || $(e.target).closest(".panel-close-btn").length){ $(this).removeClass("in-active") $("body").removeClass("overflow-hidden") } }) })($)