...
|
...
|
@@ -608,14 +608,16 @@ $searchForm.on('keyup', '.search-key', function(e) { |
|
|
$focus.addClass('action');
|
|
|
$(this).val($focus.find('.searchvalue').text());
|
|
|
} else if (e.which === 13) {
|
|
|
val = val.replace(new RegExp('\'', 'gm'), '');
|
|
|
if (val !== '') {
|
|
|
$(this).val(val);
|
|
|
$searchForm.submit();
|
|
|
}
|
|
|
} else {
|
|
|
val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符
|
|
|
|
|
|
$(this).val(val);
|
|
|
searchSuggest(val);
|
|
|
if ($searchSug && $searchSug.length) {
|
|
|
val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符
|
|
|
searchSuggest(val);
|
|
|
}
|
|
|
}
|
|
|
}).on('blur', '.search-key', function() {
|
|
|
setTimeout(function() {
|
...
|
...
|
@@ -623,39 +625,41 @@ $searchForm.on('keyup', '.search-key', function(e) { |
|
|
}, 200);
|
|
|
});
|
|
|
|
|
|
$goCart.hover(function() {
|
|
|
var data, _html = '';
|
|
|
|
|
|
if ($goCart.hasClass('on-hover')) {
|
|
|
return;
|
|
|
}
|
|
|
if ($miniCart && $miniCart.length) {
|
|
|
$goCart.hover(function() {
|
|
|
var data, _html = '';
|
|
|
|
|
|
data = $goCart.data();
|
|
|
if (data && data.num * 1) {
|
|
|
_html = '<div class="loading-cart"><h3>加载中,请稍后</h3></div>';
|
|
|
loadCartDetail(data.key);
|
|
|
} else {
|
|
|
_html = '<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>';
|
|
|
}
|
|
|
$miniCart.html(_html);
|
|
|
$goCart.addClass('on-hover');
|
|
|
}, function() {
|
|
|
$goCart.removeClass('on-hover');
|
|
|
});
|
|
|
if ($goCart.hasClass('on-hover')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$goCart.on('click', '.cart-goods-del', function() {
|
|
|
var $dom = $(this),
|
|
|
data = $dom.data(),
|
|
|
callback;
|
|
|
data = $goCart.data();
|
|
|
if (data && data.num * 1) {
|
|
|
_html = '<div class="loading-cart"><h3>加载中,请稍后</h3></div>';
|
|
|
loadCartDetail(data.key);
|
|
|
} else {
|
|
|
_html = '<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>';
|
|
|
}
|
|
|
$miniCart.html(_html);
|
|
|
$goCart.addClass('on-hover');
|
|
|
}, function() {
|
|
|
$goCart.removeClass('on-hover');
|
|
|
});
|
|
|
|
|
|
if (data) {
|
|
|
callback = function() {
|
|
|
$dom.closest('.goods-item').remove();
|
|
|
};
|
|
|
data.key = $goCart.data().key;
|
|
|
delCartGoods(data, callback);
|
|
|
}
|
|
|
});
|
|
|
$goCart.on('click', '.cart-goods-del', function() {
|
|
|
var $dom = $(this),
|
|
|
data = $dom.data(),
|
|
|
callback;
|
|
|
|
|
|
if (data) {
|
|
|
callback = function() {
|
|
|
$dom.closest('.goods-item').remove();
|
|
|
};
|
|
|
data.key = $goCart.data().key;
|
|
|
delCartGoods(data, callback);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$subNav.on({
|
|
|
mouseenter: function() {
|
...
|
...
|
|