Forum Moderators: not2easy

Message Too Old, No Replies

Simulate mouseout on a hover element with javascript

trick the browser that you`ve moved the mouse away

         

spalx

5:46 am on Aug 9, 2008 (gmt 0)

10+ Year Member



Hello guys, i`ve been a webdesigner for quite some time now, and i`ve always stumbled on your forums when i have searched for a solution for my webdesign issues, seems like though this time i didnt find a solution and its getting bad for me ... here`s the problem.
I have a css drop down menu, which uses only li:hover on its elements to work (i found it on the net somewhere), its really briliant, because it doesnt use Javascript to work, thing is i need to attach Javascript to the results inside the drop down, but when i click on any of the results, the menu does not hide, but stays and the selected item is outlined (that`s the browser net thing) and because the page does not reload, the browser keeps the drop down shown while the cusrsor is over it, so in short, is there a way i can tell the browser i`ve moved the cursor away and the :hover element should stop working, even if i didnt (i want to do that with javascript). Thanks.

csuguy

4:57 am on Aug 10, 2008 (gmt 0)

10+ Year Member



I'd have to see the code to really be of much use, but I'm assuming the css that makes the menu appear is only activated when you hover over a certain point, and not over the actual sub-menu items. If this is the case I would think you could put an <a...> tag around your menu items. You set the href attribute to "javascript:hideMenu();doFunction();" The hideMenu() function would go and hide all of your hover menu's that pop-up and the doFunction() method would be specific to whatever you want that specific menu item to do. Maybe create a goTo(url) function and pass the specific URL that you want to go to from each respecitve menu item.

To hide the menu, set the visibility of each menu to hidden.