jq 결과 집합 정렬 (가격 정렬) tab 전환
$(function() { var sortByInput = function(sortBy) { var sortEle = $('.index_goods>ul').sort(sortBy); $('.index_goods').empty().append(sortEle); }//가격대별//parseInt 정렬($(a).find('.price_pro').text().replace(/[^0-9]/ig,`) 결과 값 가져오기 var asc = function(a,b) {return parseInt($(a).find('.price_pro').text().replace(/[^0-9]/ig,)>parseInt($(b).find('.price_pro').text().replace(/[^0-9]/ig,)?-1:1;}
var desc = function(a, b) {
return parseInt($(a).find('.price_pro').text().replace(/[^0-9]/ig,'')) > parseInt($(b).find('.price_pro').text().replace(/[^0-9]/ig,'')) ? 1 : -1;
}
$('.price').on('click',function(){
var _type= $(this).attr('date-type');
if (_type =='desc') {
sortByInput(desc);
$(this).attr('date-type','asc');
$('.arrow_up').addClass('active_up');
$('.arrow_down ').removeClass('active_down');
}else{
sortByInput(asc);
$(this).attr('date-type','desc');
$('.arrow_up').removeClass('active_up');
$('.arrow_down ').addClass('active_down');
}
})
// tab class on
$('.filtrate_term li').on('click',function(){
$(this).attr('class','on').siblings('li').attr('class','');
})
})