By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Work around for li:hover in IE6

KeredDrahcir
100+
P: 426
I am using a list to create a Main Menu with a drop down submenu. I need to able to using the hover pseudo class to display the drop down menu but IE6 only allows it on anchors. Is there a work round for it because at the moment it doesn’t appear which means half the pages can't be accessed and there are enough of my visitors using IE6 still to make it worth getting it working?
Expand|Select|Wrap|Line Numbers
  1.  
  2. .mainmenu li ul {
  3.     display: none;
  4.     float: left;
  5.     left: 0;
  6.     padding: 5px 0 10px 0;
  7.     position: absolute;
  8.     text-align: left;
  9.     top: 24px;
  10.     width: 200px;
  11.     z-index: 1;
  12. }
  13.  
  14. .mainmenu li:hover ul {
  15.     display: block;
  16. }
Oct 11 '11 #1
Share this Question
Share on Google+
6 Replies


drhowarddrfine
Expert 5K+
P: 7,435
Only with javascript but I don't have that hack right now.
Oct 12 '11 #2

KeredDrahcir
100+
P: 426
Is the JavaScript simple? I don't mind using a JavaScript work round. It needs to be done. Thanks.
Oct 12 '11 #3

drhowarddrfine
Expert 5K+
P: 7,435
I'm out of town. There are examples by just Googling 'ie6 hover'.
Oct 12 '11 #4

P: 1
Use jQuery, and run:

Expand|Select|Wrap|Line Numbers
  1. $(function(){
  2.  $('li:hover').hover(function(){
  3.   $(this).css('style', 'block')
  4.  },
  5.  function(){
  6.   $(this).css('style', 'none')
  7.  });
  8.  
  9. });
  10.  
[*Edit: URL removed]
Oct 12 '11 #5

drhowarddrfine
Expert 5K+
P: 7,435
Using jQuery for this is a total overkill for this and can be accomplished in just a few lines of js instead of loading a library.
Oct 12 '11 #6

KeredDrahcir
100+
P: 426
Let me know if you can find the code please. All the results I get from Google suggest jQuery but if it can be done with JavaScript I'd rather do that.
Oct 14 '11 #7

Post your reply

Sign in to post your reply or Sign up for a free account.