$(function() {
var maxpage = 224;
$(".loading").css("display", "none");
$(".next").css("display", "none");
$.autopager({
content: "#list_lineup_area",
link: ".next a",
start: function(current, next){
$(".loading").css("display", "block");
$(".next").css("display", "none");
$(".prev").css("display", "none");
},
load: function(current, next){
$(".loading").css("display", "none");
if( current.page >= maxpage ){
$(".next").hide();
}
if($(".productBox").length){
$(".productBox .categoryLabel").matchHeight();
$(".productBox .name").matchHeight();
$(".productBox .sub").matchHeight();
$(".productBox .num").matchHeight();
$(".productBox .categoryItemColor").matchHeight();
}
}
});
$(document).on('click', ".del_search", function(){
var id = $(this).attr("id");
id = id.split("_");
var search_params = id[0];
var target_params = id[1];
$.ajax({
url : "/common/api/search_params_del.php",
type : "post",
cache : false,
data : {
s: search_params,
t: target_params
},
success: function(request){
window.location.href = "./"+request;
return;
},
error: function(request){
alert("Error!");
}
});
});
$(document).on("click", ".search_btn", function(){
var name = $(this).data("name");
var value = $(this).data("value");
if(name == "brand"){
$('[data-name="brand"]').each(function (){
$(this).addClass("search_btn");
$(this).removeClass("searchOn");
$(this).removeClass("del_search_btn");
$('input[name="brand"]').remove();
});
}
$(this).removeClass("search_btn");
$(this).addClass("searchOn");
$(this).addClass("del_search_btn");
$("", {
type:"hidden",
name:name,
value:value
}).appendTo("#side_search_top_form");
$("", {
type:"hidden",
name:name,
value:value,
class:"search_val"
}).appendTo("#side_search_bottom_form");
if($("#side_search_bottom_form").children("input.search_val").length > 0){
$(".search_submit_btn").addClass("blinking");
}
});
$(document).on("click", ".del_search_btn", function(){
$(this).addClass("search_btn");
$(this).removeClass("searchOn");
$(this).removeClass("del_search_btn");
var name = $(this).data("name");
var value = $(this).data("value");
$("#side_search_top_form").find('input[name="'+name+'"]').each(function (){
if($(this).val() == value){
$(this).remove();
return false;
}
});
$("#side_search_bottom_form").find('input[name="'+name+'"]').each(function (){
if($(this).val() == value){
$(this).remove();
return false;
}
});
if($("#side_search_bottom_form").children("input.search_val").length <= 0){
$(".search_submit_btn").removeClass("blinking");
}
});
$(document).on("click", ".all_del_search", function(){
$("#modalSearchMore").find(".searchOn").addClass("search_btn");
$("#modalSearchMore").removeClass("searchOn");
$("#modalSearchMore").removeClass("del_search_btn");
$("#side_search_top_form").find('input[type="hidden"]').each(function (){
if($(this).attr("name") != "category"){
$(this).remove();
}
});
$("#side_search_bottom_form").find('input[type="hidden"]').each(function (){
if($(this).attr("name") != "category"){
$(this).remove();
}
});
});
$("#slider_min, #slider_max").on("change", function(){
var min = $("#slider_min").val();
if(!min){
min = 500;
}
var max = $("#slider_max").val();
if(!max){
max = 40000;
}
$("#price_slider").slider({
values: [min, max]
});
});
$("#range").noUiSlider({
start: [500, 40000],
step: 500,
connect: true,
format: wNumb({
decimals: 0
}),
range: {
'min': 500,
'max': 40000
}
});
$('#range').Link('lower').to($('#value-lower'), 'val');
$('#range').Link('upper').to($('#value-upper'), 'val');
$('#range').Link('lower').to($('.hidden-lower'), 'val');
$('#range').Link('upper').to($('.hidden-upper'), 'val');
});