[-] MO : fixed javascript bug on mouse event
This commit is contained in:
@@ -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(){
|
||||||
@@ -632,12 +646,24 @@ $(document).ready(function(){
|
|||||||
ajaxCart.refresh();
|
ajaxCart.refresh();
|
||||||
|
|
||||||
/* roll over cart */
|
/* roll over cart */
|
||||||
$("#shopping_cart").mouseenter(function(){
|
var cart_block = new HoverWatcher('#cart_block');
|
||||||
|
var shopping_cart = new HoverWatcher('#shopping_cart');
|
||||||
|
|
||||||
|
$("#shopping_cart").hover(function(){
|
||||||
$("#cart_block").stop(true, true).slideDown(450);
|
$("#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