We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 70
    • 23 Posts
    I am working on a template cms. I am having trouble with the css menu. The following HTML/CSS is strictly static. When I am able to get it working, I will port over to the template.

    1. I can get the first and second level menu hyperlinks to work in both IE6 and Firefox 1.0.7. But I am having problems with more than two levels always displaying. You can see the issue when you hover over the last menu link "Page Four".
    Test page: http://www.munyak.com/lp/index.htm
    li:hover ul, li.over ul { display: block;}
    


    2. If I change the li:hover, I can make multi-levels work properly in Firefox using the following.
    li:hover > ul, li.over > ul { display: block;}
    


    This was a hack I figured out when looking at Eric Meyers css for "pure css menus" and applied to the suckerfish css. Again, looking at the last menu link, the thrid sub-level does not display until after hovering over the link for sub 4-3

    However, in IE6, only the first level menu links function. All sub-levels will not display sad
    Test page: http://www.munyak.com/lp/page2.htm


    How can I make (2) work in both IE6 and Firefox ?

    I will eventually be trying to make this work by using the ListMenu snippet. If you have any comments regarding this, I would be greatful.

    The following is not the entire page. The css is snipped from my css page. The javascript is the only javascript in the page. It is from the suckerfish dropdown menu article.

    <style type="text/css">
    /*
    http://www.alistapart.com/articles/dropdowns
    This css scheme derived from "suckerfish" concept. (ALA)
    
    */
    
    
    ul {
    	margin: 0;
    	padding: 0;
    	list-style: none;
    	width: 100%;
    	float:right;
    	border-bottom: 1px solid #ccc;	
    }
    
    ul li {
    	position: relative;
    	}
    
    li ul {
    	position: absolute;
    	left: -149px;
    	top: 0;
    	display: none;
    }
    	
    ul li a {
    	font:bold 11px/16px arial, helvetica, serif;
    	display: block;
    	color: #777;
    	background: #ffc; /*yellow*/
    	padding: 5px;
    	border: 1px solid #ccc;
    	border-bottom: 0; 
    	text-decoration:none;
    }
    
    ul li a:hover {
    	font:bold 11px/16px arial, helvetica, serif;
    	display: block;
    	color: #a00;
    	background: #fff;
    	padding: 5px;
    	border: 1px solid #ccc;
    	border-bottom: 0; 
    	text-decoration:none;
    }	
    
    /* Fix IE. Hide from IE Mac \*/
    * html ul li { float: left; height: 1%; }
    * html ul li a { height: 1%; }
    /* End */
    
    /*  (1)-This displays all submenus in both ie/firefox */
    li:hover ul, li.over ul { display: block;}
    
    /*  (2)-This only shows submenus in firefox. submenus in IE do not display 
    li:hover > ul, li.over > ul { display: block;}
    
    */
    
    </style>
    
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    startList = function() {
    	if (document.all&&document.getElementById) {
    		navRoot = document.getElementById("nav");
    		for (i=0; i<navRoot.childNodes.length; i++) {
    			node = navRoot.childNodes[i];
    			if (node.nodeName=="LI") {
    				node.onmouseover=function() {
    					this.className+=" over";
    				}
    				node.onmouseout=function() {
    					this.className=this.className.replace(" over", "");
    				}
    			}
    		}
    	}
    }
    window.onload=startList;
    
    //--><!]]>
    </script>
    
    <div id="sidebar">
    		<ul id="nav">
    			<li><a href="index.htm" title="Page One">Page One</a></li>
    			<li><a href="#" title="Page One">Page Two ...</a>
    				<ul>
    					<li><a href="#" title="Page One">sub 2-1</a></li>
    					<li><a href="#" title="Page Two">sub 2-2</a></li>
    				</ul>
    			</li>	
    			<li><a href="#" title="Page Three">Page Three ...</a>
    				<ul>
    					<li><a href="#" title="Page One">sub 3-1</a></li>
    					<li><a href="#" title="Page Two">sub 3-2</a></li>
    				</ul>				
    			</li>
    			<li><a href="#" title="Page four">Page Four ...</a>
    				<ul>
    					<li><a href="#" title="Page One">sub 4-1</a></li>
    					<li><a href="#" title="Page Two">sub 4-2</a></li>
    					<li><a href="#" title="Page Two">sub 4-3 ...</a>												
    						<ul>
    							<li><a href="#" title="Page One">sub 4-3-1</a></li>
    						</ul>
    					</li>
    					<li><a href="#" title="Page Two">sub 4-4</a></li>
    				</ul>				
    			</li>
    		</ul>		
    </div>
    


    Thanks, Don
      I am but a dwarf in a land of giants... with propellars, calculators, bluetooth and beepers smiley
      • 13205
      • 9 Posts
      Yeah, I just fought through this same problem. Here is what I did:

      <head>
      <script type="text/javascript" src="http://www.thechurchtoday.org/itsapcthing/assets/templates/greenery/iehover.js"></script>
      


      I called this at the top of my HTML file. It refers to this:

      startList = function() {
      if (document.all && document.getElementById) {
      navRoot = document.getElementById("nav");
      for (i=0; i<navRoot.childNodes.length; i++) {
        node = navRoot.childNodes[i];
        if (node.nodeName=="LI") {
        node.onmouseover=function() {
        this.className+=" over";
          }
        node.onmouseout=function() {
        this.className=this.className.replace
            (" over", "");
         }
         }
        }
       }
      }
      window.onload=startList;


      It’s the suckerfish hack. But that is the only way I could get it to work.

      You can see it work here: http://www.itsapcthing.com/index.php?id=13

      Hope that helps..

      Bradley
        Man is the best computer we can put aboard a spacecraft ... and the only one that can be mass produced with unskilled labor. Werner von Braun
      • The problem is that IE doesn’t support the :hover pseudoelement on anything except <a href=...> tags. The default installation of MODx comes with this in its template:

        <!--[if lte IE 6]>
        
          <style type="text/css" media="screen, tv, projection">
                body { behavior: url(assets/js/csshover.htc); } /* hover:anything support */
                #content { margin-left: 22px; } /* to avoid the BMH */
                a,  a:link { border-bottom-style: solid } /* becuase IE just doesn't dot */
          </style>
        
          <script type="text/javascript" src="assets/js/sleight.js"></script>
        
        <![endif]-->


        I’ve set the conditional to [if IE], and it works fine, making IE respond to any tag’s :hover pseudoelement. I also removed the link to the sleight.js file, as I’ve had spotty results with it.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 70
          • 23 Posts
          Bradley... I tried your link. Nice template. However, I can’t seem to hover over "contact". Also, does your menu work in IE for child-level links under Tea and Photo’s ?

          Sottwell... I have tried many different css menus over the last three weeks trying to come up with my own template. I was trying to use the ListMenu snippet. I remember seeing the [if lte IE 6] conditional.

          Are you saying that I need to include the conditional in my template as well, then it should work properly without calling my js file (since it would be redundant) ??

          Thanks, Don
            I am but a dwarf in a land of giants... with propellars, calculators, bluetooth and beepers smiley
          • You’ll need some "alternate method" to get hover-anything to work in IE. Whether or not you put that in an IE conditional comment or just in the head for everyone to use is up to you. I prefer the lte IE 6 CC because IE 7 should theoretically behave better, it targets Redmond’s browser, and it means one last thing to go back and fix on existing sites.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • Yes, this "behavior" file will allow all elements to have a :hover pseudoclass. I’m not sure why the one that comes in MODx says "lt 6"; possibly that should be "lt 7" if IE 7 is going to support :hover?

              I also frequently use that to add one or two IE specific styles, or to include an IE-specific stylesheet if there are too many IE bugs in my regular CSS.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
              • lte = less than or equal ... lt 7 should also work and is one less character too boot!
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 13205
                  • 9 Posts
                  Quote from: 24jedi at Dec 20, 2005, 04:10 PM

                  Bradley... I tried your link. Nice template. However, I can’t seem to hover over "contact". Also, does your menu work in IE for child-level links under Tea and Photo’s ?

                  I noticed that on Contact, but shortly after I got that far, my need for the DropMenu changed and is no longer neccessary for the site I’m working on. So that’s why I didn’t try anything else on it.


                  Bradley
                    Man is the best computer we can put aboard a spacecraft ... and the only one that can be mass produced with unskilled labor. Werner von Braun
                  • Quote from: rthrash at Dec 20, 2005, 04:16 PM

                    lte = less than or equal ... lt 7 should also work and is one less character too boot!

                    Wow, never noticed the "e" there; I need new glasses (or maybe just give these a good cleaning...)

                    BTW, very nice use of the "greenery" template!
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 13577
                      • 302 Posts
                      You can read about whatever:hover if you want. It makes ANYTHING hoverable in IE. I don’t use it because - I like to use simpler techniques (which at times makes it impossible to achieve an exact effect). But there it is if you are interested.

                      Also, thought I should mention that the config option in ListMenu that has to do with IE is for removing white space between <li> elements - NOT for making hovers work on anything but <a> tags. Turns out IE really messes up styles of lists if there is white space. It’s often a frustration so I write snippets to have that configurable.
                        Standard Disclaimer
                        I could be totally wrong.