[-] MO : fixed javascript bug on mouse event
This commit is contained in:
@@ -165,7 +165,7 @@ var ajaxCart = {
|
|||||||
updateCartInformation : function (jsonData, addedFromProductPage)
|
updateCartInformation : function (jsonData, addedFromProductPage)
|
||||||
{
|
{
|
||||||
ajaxCart.updateCart(jsonData);
|
ajaxCart.updateCart(jsonData);
|
||||||
|
|
||||||
//reactive the button when adding has finished
|
//reactive the button when adding has finished
|
||||||
if (addedFromProductPage)
|
if (addedFromProductPage)
|
||||||
$('body#product p#add_to_cart input').removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled');
|
$('body#product p#add_to_cart input').removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled');
|
||||||
@@ -395,7 +395,7 @@ var ajaxCart = {
|
|||||||
|
|
||||||
// Update product quantity
|
// Update product quantity
|
||||||
updateProductQuantity : function (product, quantity) {
|
updateProductQuantity : function (product, quantity) {
|
||||||
|
|
||||||
$('dt#cart_block_product_' + product.id + '_' + (product.idCombination ? product.idCombination : '0')+ '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + ' .quantity').fadeTo('fast', 0, function() {
|
$('dt#cart_block_product_' + product.id + '_' + (product.idCombination ? product.idCombination : '0')+ '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + ' .quantity').fadeTo('fast', 0, function() {
|
||||||
$(this).text(quantity);
|
$(this).text(quantity);
|
||||||
$(this).fadeTo('fast', 1, function(){
|
$(this).fadeTo('fast', 1, function(){
|
||||||
@@ -427,7 +427,7 @@ var ajaxCart = {
|
|||||||
}
|
}
|
||||||
//if product is not in the displayed cart, add a new product's line
|
//if product is not in the displayed cart, add a new product's line
|
||||||
var domIdProduct = this.id + '_' + (this.idCombination ? this.idCombination : '0') + '_' + (this.idAddressDelivery ? this.idAddressDelivery : '0');
|
var domIdProduct = this.id + '_' + (this.idCombination ? this.idCombination : '0') + '_' + (this.idAddressDelivery ? this.idAddressDelivery : '0');
|
||||||
|
|
||||||
var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0');
|
var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0');
|
||||||
if($('#cart_block dt#cart_block_product_'+ domIdProduct ).length == 0)
|
if($('#cart_block dt#cart_block_product_'+ domIdProduct ).length == 0)
|
||||||
{
|
{
|
||||||
@@ -618,6 +618,20 @@ var ajaxCart = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function HoverWatcher(selector){
|
||||||
|
this.hovering = false;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.isHoveringOver = function() {
|
||||||
|
return self.hovering;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(selector).hover(function() {
|
||||||
|
self.hovering = true;
|
||||||
|
}, function() {
|
||||||
|
self.hovering = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//when document is loaded...
|
//when document is loaded...
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@@ -630,14 +644,26 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
ajaxCart.overrideButtonsInThePage();
|
ajaxCart.overrideButtonsInThePage();
|
||||||
ajaxCart.refresh();
|
ajaxCart.refresh();
|
||||||
|
|
||||||
/* roll over cart */
|
/* roll over cart */
|
||||||
$("#shopping_cart").mouseenter(function(){
|
var cart_block = new HoverWatcher('#cart_block');
|
||||||
$("#cart_block").stop(true, true).slideDown(450);
|
var shopping_cart = new HoverWatcher('#shopping_cart');
|
||||||
|
|
||||||
|
$("#shopping_cart").hover(function(){
|
||||||
|
$("#cart_block").stop(true, true).slideDown(450);
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
if (!cart_block.isHoveringOver())
|
||||||
|
$("#cart_block").stop(true, true).slideUp(450);
|
||||||
|
}, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#cart_block").mouseleave(function(){
|
$("#cart_block").hover(function() {}, function(){
|
||||||
$(this).stop(true, true).slideUp(450);
|
setTimeout(function() {
|
||||||
|
if (!shopping_cart.isHoveringOver())
|
||||||
|
$("#cart_block").stop(true, true).slideUp(450);
|
||||||
|
}, 200);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user