Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys, I have a smaall issue that maybe you could help me with. I have a web application and on the screens if the a dropdown list is selected and if you hover over a menu item the dropdown list is displayed through the menu item. I tried setting the Z-Index of the dropdown to -1 and the z-index of the menu item to 1 but no luck. Thanks for your help guys.
Posted

1 solution

Try hiding all the dropdowns whenever onmouseover event occurs on the menu item. Similarly, unhide the dropdowns whenever onmouseout event occurs.

code would be something like below -
JavaScript
function toggleDropdown(action) { 
// action is boolean variable
// true : hide dropdown (call on mouseover)
// false: show dropdown (call on mouseout)

var dropdowns = document.getElementsByTagName('select');
var cssText = action ? 'none' : '';
for(i = 0; i < dropdowns.length; i++) {
  dropdowns[i].style.display = cssText;
}


Hope this may help you out...

Regards,
Niral Soni
 
Share this answer
 
Comments
frostcox 9-Nov-12 7:32am    
Yeah cool makes sense, il implement this when I get a chance and accept your solution, thanks for your help.
frostcox 9-Nov-12 10:40am    
Hey I had a chance to test this out and it is not hiding the dropdown on mouse out, any other ideas?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900