Work around for li:hover in IE6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KeredDrahcir
    Contributor
    • Nov 2009
    • 426

    Work around for li:hover in IE6

    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?
    Code:
    .mainmenu li ul {
    	display: none;
    	float: left;
    	left: 0;
    	padding: 5px 0 10px 0;
    	position: absolute;
    	text-align: left;
    	top: 24px;
    	width: 200px;
    	z-index: 1;
    }
    
    .mainmenu li:hover ul {
    	display: block;
    }
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Only with javascript but I don't have that hack right now.

    Comment

    • KeredDrahcir
      Contributor
      • Nov 2009
      • 426

      #3
      Is the JavaScript simple? I don't mind using a JavaScript work round. It needs to be done. Thanks.

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        I'm out of town. There are examples by just Googling 'ie6 hover'.

        Comment

        • john605
          New Member
          • Oct 2011
          • 1

          #5
          Use jQuery, and run:

          Code:
          $(function(){
           $('li:hover').hover(function(){
            $(this).css('style', 'block')
           },
           function(){
            $(this).css('style', 'none')
           });
          
          });
          [*Edit: URL removed]
          Last edited by Stewart Ross; Oct 12 '11, 11:30 PM. Reason: URL for another forum removed

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            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.

            Comment

            • KeredDrahcir
              Contributor
              • Nov 2009
              • 426

              #7
              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.

              Comment

              Working...