您好我的排序功能有问题。 我已经看过了这个:jQuery function doesn't work on Safari 使用parsefloat并没有解决我的问题。有人可以帮忙吗?
此脚本在Firefox中完美运行。
var totalProdblk,priceAsc,priceDesc;
totalProdblk = $('.prodblk');
priceAsc = $('#priceAsc');
priceDesc = $('#priceDesc');
// Price
priceAsc.click(function(){
totalProdblk.sort(function(a, b){
return a.getAttribute('data-price') > b.getAttribute('data-price')
}).appendTo(totalProdblk.parent());
});
priceDesc.click(function(){
totalProdblk.sort(function(a, b){
return a.getAttribute('data-price') < b.getAttribute('data-price')
}).appendTo(totalProdblk.parent());
});