[-] MO : fixed javascript bug on mouse event
This commit is contained in:
1 parent
585b670df3
commit
47db45fbd9
1 file changed
+29
-3
@@ -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...
|
||||
$(document).ready(function(){
|
||||
@@ -632,12 +646,24 @@ $(document).ready(function(){
|
||||
ajaxCart.refresh();
|
||||
|
||||
/* 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);
|
||||
},
|
||||
function() {
|
||||
setTimeout(function() {
|
||||
if (!cart_block.isHoveringOver())
|
||||
$("#cart_block").stop(true, true).slideUp(450);
|
||||
}, 200);
|
||||
});
|
||||
|
||||
$("#cart_block").mouseleave(function(){
|
||||
$(this).stop(true, true).slideUp(450);
|
||||
$("#cart_block").hover(function() {}, function(){
|
||||
setTimeout(function() {
|
||||
if (!shopping_cart.isHoveringOver())
|
||||
$("#cart_block").stop(true, true).slideUp(450);
|
||||
}, 200);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user