Authored by zzzzzzz

收藏人数随着状态动态变化

... ... @@ -272,6 +272,7 @@ var $collect = $('.fav-container');
$collect.on('touchstart', function() {
var opt = $(this).hasClass('fav-yes') ? 'cancel' : 'ok';
var self = $(this);
var num = parseInt(self.parent().find('.faved-num').html());
$.ajax({
method: 'get',
... ... @@ -291,10 +292,14 @@ $collect.on('touchstart', function() {
if (self.hasClass('fav-yes')) {
self.hide();
self.prev().show();
num--;
self.parent().find('.faved-num').html(num + '人已收藏');
tip.show('取消收藏成功!');
} else {
self.hide();
self.next().show();
num++;
self.parent().find('.faved-num').html(num + '人已收藏');
tip.show('收藏成功!');
}
}
... ...