I've written the following slide menu: http://www.julian-urabl.com/webtest/index.html
It works perfectly except for one behavior I'd like to add:
Onload if the mouse is not being placed over the div-container "menu", the menu should contract afer 1000ms.
I thought about checking, if the mouse was being placed over the div and only on return "false" I'd let the menu slide out via
setTimeout(function(){slide.style.marginLeft="-140px"},1000);
I am totally new to js, but if I understood right neither hover, nor mouseover, nor mouseenter will help solve my problem. Can anyone help me?
"nav". Let's call the with dashed border "menu". Let's call the state of being expanded (marginLeft:0) "visible". Let's call the state of being contracted (marginLeft:-140px) "hidden".
The page loads: Nav is visible.
After 1 sec: nav slides to hidden.
User moves mouse over menu: nav slides to visible.
User moves mouse outside menu: nav slides to hidden.
Now there is one exception:
If the page loads and the mouse is still over menu (e.g. after hitting "Reload") nav should be prevented from sliding to hidden, instead stay visible until user leaves menu.
– user2741341 Sep 03 '13 at 02:35