qntmfred retired 40719 Posts user info edit post |
i posted this on devshed forums but i figured i'd try here too
i'm building a menu that opens on click and closes when the mouse is moved out of the menu. the problem i'm having is that the onmouseout even seems to be triggered when it shouldn't. for example, the menu disappears when i move the cursor from Menu1 to Menu2
example at http://65.185.91.185/scrilla/test.php
here's the html
<span onclick=toggle("trans_account_list");>Menu</span><br><br> <div id="trans_account_list" style="display:none" onmouseout=setTimeout("toggle('trans_account_list');",500);> <div class="trans_account" onclick=window.location="trans.php?acct=1">Menu 1</div> <div class="trans_account" onclick=window.location="trans.php?acct=2">Menu 2</div> </div>
here's the javascript
function toggle(obj) { with (document.getElementById(obj).style) { display = (display == 'none') ? 'block' : 'none'; } }
here's the css
#trans_account_list { position: relative; z-index: +1; border: 1px solid #000; font-size: 9pt; }
div.trans_account { padding: 2 10; }
div.trans_account:hover { background: #ccc; } 8/7/2005 11:12:03 AM |
qntmfred retired 40719 Posts user info edit post |
help plz 8/7/2005 6:05:58 PM |
seedless All American 27142 Posts user info edit post |
i have tried an few things, only thing left that i can think of to do is to write a conditional statement. can i borrow this script? 8/7/2005 7:04:59 PM |
qntmfred retired 40719 Posts user info edit post |
conditional statement for what?
yeah you can use it, but it doesn't work see
btw, mostly testing in firefox, but it doesn't work great in IE either
[Edited on August 7, 2005 at 7:41 PM. Reason : :hover doesn't work at all in IE, but that's not the point] 8/7/2005 7:31:49 PM |
seedless All American 27142 Posts user info edit post |
well, i want to use it just to try some shit. make an 'if' statement so when on mouseout you have like 2 seconds until it touches another menu item or it goes anyway then, or something like that. 8/7/2005 7:34:44 PM |
qntmfred retired 40719 Posts user info edit post |
yeah i guess i could do something like that, i just was curious why it didn't work
example of the functionality i'm looking for at
http://www.howtocreate.co.uk/tutorials/jsexamples/showhidedelay.html
which works perfectly, so why doesn't mine 8/7/2005 7:42:37 PM |
qntmfred retired 40719 Posts user info edit post |
anybody else have any insight 8/8/2005 10:53:07 AM |
Incognegro Suspended 4172 Posts user info edit post |
don't you need to use the . operator in a with block still
apparently not, that's odd
[Edited on August 8, 2005 at 11:01 AM. Reason : !]
8/8/2005 10:58:08 AM |