Search...
스마트필터 스크립트
아래 소스코드 참고하자
js
/**
* 선택초기화 클릭시
*/
$('#reset_btn').on('click',function () {
$(".sm_brand_wrap > .sm_chk_box").removeClass("on");
$('#priceMin').val('');
$('#priceMax').val('');
$('.sort_item').removeClass('on');
$('#sct_sortlst > div.sct_sort > div > ul > li:nth-child(2)').addClass('on');
$('#page_rows').val('20').prop("checked",true);
let currentURL = window.location.href;
if (currentURL.indexOf("&") > 0) {
let cleanURL = currentURL.substring(0, currentURL.indexOf("&"));
window.history.replaceState({}, document.title, cleanURL);
}
modelsRequests(parameter[1]);
});
$('input[name^=filter_brand]').on('change',function() {
var brandStr = '';
$('input[name*=filter_brand]').each(function() {
if($(this).is(":checked")){
brandStr += (brandStr) ? "&" + "filter_brand[]="+$(this).val() : "filter_brand[]="+$(this).val() ;
}
});
var currentURL = window.location.href;
var currentURLSplit = currentURL.split("?");
var filter_parameter = currentURLSplit[0] + "?ca_id=" + getQueryParam('ca_id') + "&" + brandStr;
history.pushState(null, null, filter_parameter);
modelsRequests(currentURLSplit[1]);
});