Posted By

eckbert on 01/11/11


Tagged

textmate combo jquery box replacment


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

qubestream
virendrakryadav
wirenaught


dropdown replacement close


 / Published in: jQuery
 

  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  

You need to login to post a comment.