$(document).ready(function () { /* 價錢篩選*/ // $('.nstSlider').nstSlider({ // "left_grip_selector": ".leftGrip", // "right_grip_selector": ".rightGrip", // "value_bar_selector": ".bar", // "highlight": { // "grip_class": "gripHighlighted", // "panel_selector": ".highlightPanel" // }, // "value_changed_callback": function(cause, leftValue, rightValue) { // $('.leftLabel').text(leftValue); // $('.rightLabel').text(rightValue); // }, // }); // Call methods and such... // var highlightMin = Math.random() * 20, // highlightMax = highlightMin + Math.random() * 80; // $('.nstSlider').nstSlider('highlight_range', highlightMin, highlightMax); /* 價錢篩選end*/ // if($("#picSlides .picItem").length>1){ // $("#picSlides").owlCarousel({ // loop : true, // items : 1, // nav : true, // autoplay:true, // autoplayTimeout:5000, // }); // } $('.filterbox').ontouchmove = function(event){ event.preventDefault(); } var _window = $(window); var _body = $('body'); var change_1023 = 0; var productSlidebox = $(".productSlidebox"); if(_window.width() <= 1023 && change_1023 != 1023){ change_1023 = 1023; $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').attr('checked',true); }else if(_window.width() > 1023 && change_1023 != 1200){ change_1023 = 1200; productSlidebox.owlCarousel({ loop : true, items : 1, nav : true, }); } _window.on('resize',function(){ $('.nstSlider').nstSlider('refresh'); if(_window.width() <= 1023 && change_1023 != 1023){ change_1023 = 1023; $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').attr('checked',true); productSlidebox.trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded'); productSlidebox.find('.owl-stage-outer').children().unwrap(); }else if(_window.width() > 1023 && change_1023 != 1200){ change_1023 = 1200; productSlidebox.owlCarousel({ loop : true, items : 1, nav : true, }); $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').removeAttr('checked'); } }); var clickbutton=0; $('.filter-button,.filterbox .close').on('click',function(){ clickbutton++; if(clickbutton==1){ $('.filterbox').css({'top':'50px'}); } if(clickbutton==2){ $('.filterbox').css({'top':'-100%'}); clickbutton=0; } }); $('#viewMode .view-three').on('click',function(){ // console.log('message'); $('#viewMode .view-three').addClass('now'); $('#viewMode .view-four').removeClass('now'); $('.content').removeClass('view-four').addClass('view-three hide-back'); $('.content .warpper').show(); setTimeout(function(){ $('.content').removeClass('hide-back'); $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').attr('checked',true); productSlidebox.trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded'); productSlidebox.find('.owl-stage-outer').children().unwrap(); productSlidebox.owlCarousel({ loop : true, items : 1, nav : true, navText:["",""], }); $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').removeAttr('checked'); },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'); // $('.content .warpper').hide(); setTimeout(function(){ $('.content').removeClass('hide-back'); $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').attr('checked',true); productSlidebox.trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded'); productSlidebox.find('.owl-stage-outer').children().unwrap(); productSlidebox.owlCarousel({ loop : true, items : 1, nav : true, navText:["",""], }); $('#filtercontrol-2,#filtercontrol-3,#filtercontrol-4').removeAttr('checked'); },380); }); $(".newbox").find(function(){ $(".newitem").parents("#newlist").prevAll("#newTitle").removeAttr('checked') }) });