$(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');
$('#viewMode .view-list').removeClass('now');
$('.content').removeClass('view-four').removeClass('view-list').addClass('view-three hide-back');
$('.content .warpper').show();
//變更不同尺寸圖片(一列4筆:L_、一列3筆:D_)
$('.productImg').each(function(){
var oUrl = $(this).find('img').attr('src');
var oUrl_Arr = oUrl.split('/');
var oPic = oUrl_Arr[oUrl_Arr.length - 1];
var nPic = oPic.replace('L_','D_');
oUrl_Arr[oUrl_Arr.length - 1] = nPic;
var nUrl = oUrl_Arr.join('/');
$(this).find('img').attr('src',nUrl);
});
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');
$('#viewMode .view-list').removeClass('now');
$('.content').removeClass('view-three').removeClass('view-list').addClass('view-four hide-back');
//變更不同尺寸圖片(一列4筆:L_、一列3筆:D_)
$('.productImg').each(function(){
var oUrl = $(this).find('img').attr('src');
var oUrl_Arr = oUrl.split('/');
var oPic = oUrl_Arr[oUrl_Arr.length - 1];
var nPic = oPic.replace('D_','L_');
oUrl_Arr[oUrl_Arr.length - 1] = nPic;
var nUrl = oUrl_Arr.join('/');
$(this).find('img').attr('src',nUrl);
});
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-list').on('click',function(){
$('#viewMode .view-four').removeClass('now');
$('#viewMode .view-three').removeClass('now');
$('#viewMode .view-list').addClass('now');
$('.content .warpper').removeAttr('style');
$('.content').removeClass('view-four').removeClass('view-three').addClass('view-list');
});
$(".Act9_Count_Down").each(function(){
var $this = $(this),
hour = $(this).attr("hour"),
min = $(this).attr("minute"),
sec = $(this).attr("second"),
time = $(this).attr("time");
setInterval(function(){
time -=1;
var str = '',
date = new Date(),
new_hour = Math.floor(time/3600),
new_min = Math.floor(time/60)%60,
new_sec = time%60;
if(new_hour < 0){
str += '00:';
}else if(new_hour < 10){
str += '0'+(new_hour) + ':';
}else{
str += (new_hour) + ':';
}
if(new_min < 0){
str += '00:';
}else if(new_min < 10){
str += '0'+(new_min) + ':';
}else{
str += (new_min) + ':';
}
if(new_sec < 0){
str += '00';
}else if(new_sec < 10){
str += '0'+(new_sec);
}else{
str += (new_sec);
}
$this.html(str);
},1000);
});
});
$(".today-wrapper").owlCarousel({
loop : true,
items : 1,
nav : true,
navText : ['',''],
dots:false,
autoplay:true,
navSpeed:1000,
autoplayTimeout:8000,
autoplaySpeed:1000,
});
$(".sellList-wrapper").on('mouseenter', '.sellList-item', function(event) {
$(".sellList-item.open").removeClass('open');
$(this).addClass('open');
});