diff options
author | matthew <matthew> | 2007-02-08 22:08:19 +0000 |
---|---|---|
committer | matthew <matthew> | 2007-02-08 22:08:19 +0000 |
commit | d65e723f24cd409b5324e9f8e121bc01aef06017 (patch) | |
tree | de5756b15d812757fc0e61806a6c155b20d19c99 /web/js.js | |
parent | 7e815f73b81f7599a49003ee763878bf949cac74 (diff) |
Close email alert box if move mouse away.
Diffstat (limited to 'web/js.js')
-rw-r--r-- | web/js.js | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -39,18 +39,37 @@ YAHOO.util.Event.onContentReady('mapForm', function() { } }); +var timer; +function email_alert_close() { + YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'none'); +} YAHOO.util.Event.onContentReady('email_alert', function() { YAHOO.util.Event.addListener(this, 'click', function(e) { YAHOO.util.Event.preventDefault(e); if (YAHOO.util.Dom.getStyle('email_alert_box', 'display') == 'block') { - YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'none'); + email_alert_close(); } else { var pos = YAHOO.util.Dom.getXY(this); pos[0] -= 20; pos[1] += 20; YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'block'); YAHOO.util.Dom.setXY('email_alert_box', pos); + document.getElementById('alert_email').focus(); } }); + YAHOO.util.Event.addListener(this, 'mouseout', function(e) { + timer = window.setTimeout(email_alert_close, 2000); + }); + YAHOO.util.Event.addListener(this, 'mouseover', function(e) { + window.clearTimeout(timer); + }); +}); +YAHOO.util.Event.onContentReady('email_alert_box', function() { + YAHOO.util.Event.addListener(this, 'mouseout', function(e) { + timer = window.setTimeout(email_alert_close, 2000); + }); + YAHOO.util.Event.addListener(this, 'mouseover', function(e) { + window.clearTimeout(timer); + }); }); // I love the global |