/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function containsPoint(elem, x, y){ var top = elem.offset()['top']; var bottom = (elem.offset()['top'] + elem.outerHeight()); var left = elem.offset()['left']; var right = (elem.offset()['left'] + elem.outerWidth()); if((x > left) && (x < right) && (y > top) && (y < bottom)) return true; else return false; } function closeMenu(e){ var box = $('.dropdown-rplcmnt'); var box2 = $('.over-menu'); var px = e.pageX; var py = e.pageY; if(containsPoint(box,px,py) || containsPoint(box2,px,py)); else { box2.stop().fadeOut(400); } }