dropdown replacement close


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function containsPoint(elem, x, y){
  2. var top = elem.offset()['top'];
  3. var bottom = (elem.offset()['top'] + elem.outerHeight());
  4. var left = elem.offset()['left'];
  5. var right = (elem.offset()['left'] + elem.outerWidth());
  6. if((x > left) && (x < right) && (y > top) && (y < bottom)) return true;
  7. else return false;
  8. }
  9.  
  10. function closeMenu(e){
  11. var box = $('.dropdown-rplcmnt');
  12. var box2 = $('.over-menu');
  13. var px = e.pageX;
  14. var py = e.pageY;
  15. if(containsPoint(box,px,py) || containsPoint(box2,px,py));
  16. else {
  17. box2.stop().fadeOut(400);
  18. }
  19. }
  20.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.