Jump to content

Dropdown menu


phpnoob
 Share

Recommended Posts

I hope someone can help me.I have a really good Drop-down menu on html 4.01, than what is the problem? :) i want to modifying the website to XHTML 1.0The problem is, i use an IE hack, and the Sub Drop-down menu "Menu 2", not dropped down, help me.XHTML

<div class="menu">	<ul>		<li>		 <a href="link" >Menu</a>			<ul class="menu">				<li>				 <a>Menu 1</a>				</li>				<li>				 <a class="hide" href="link">Menu 2 ></a>					<ul>						<li>						 <a>Menu 2.a</a>						</li>					</ul>				</li>						</ul>				</li>	</ul>

CSS

body {behavior: url("hover.htc");}.menu {width: 770px;height: 24px;margin-right: auto;margin-left: auto;}.menu ul li a {display:block;text-decoration:none;width:110px;height:24px;text-align:center;border:0px solid #000000;line-height:20px;font-size:12px;overflow:hidden;margin-right: auto;margin-left: auto;	font-family: Arial, Helvetica, sans-serif;font-weight: bolder;background-image: url(image/menu.png);background-repeat: no-repeat;color: #000000;float:left;}.menu ul li:hover a {background-image: url(image/menu.png);background-position: -110px 0px;}.menu ul li:hover ul li a.hide {background-image: url(./image/menu.png);background-position: 0px -26px;background-repeat: no-repeat;color: #FFFFFF;}.menu ul li:hover ul li:hover a.hide {color: #FFFFFF;width: 110px;background-image: url(image/menu.png);background-position: -110px -26px;background-repeat: no-repeat;}.menu ul li:hover ul li:hover ul li:hover a	 {background-image: url(./image/menu.png);background-position: -110px -26px;background-repeat: no-repeat;color: #FFFFFF;}.menu ul li:hover ul li:hover ul li a	 {color: #FFFFFF;width: 110px;background-image: url(image/menu.png);background-position: 0px -26px;background-repeat: no-repeat;}.menu ul li a:visited {display:block;text-decoration:none;width:110px;height:24px;text-align:center;border:0px solid #000000;line-height:20px;font-size:12px;overflow:hidden;margin-right: auto;margin-left: auto;	font-family: Arial, Helvetica, sans-serif;font-weight: bolder;background-repeat: no-repeat;}.menu ul li:hover ul li a {color: #FFFFFF;background-image: url(./image/menu.png);background-position: 0px -26px;background-repeat: no-repeat;}.menu ul li:hover ul li:hover a{ background-image: url(./image/menu.png);background-position: -110px -26px;color: #FFFFFF;}.menu ul {padding:0;margin:0;list-style: none;}.menu ul li {float:left;position:relative; width:-110px;}.menu ul li ul {display: none;}.menu ul li:hover ul {display:block;position:absolute;top:24px;left:0;width:110px;}.menu ul li:hover ul li ul {display: none;}.menu ul li:hover ul li a:hover {background-repeat: no-repeat;}.menu ul li:hover ul li:hover ul {display:block;position:absolute;left:110px;top:0;}.menu ul li:hover ul li:hover ul.left {left:-110px;}

Script:hover.htc

<public:attach event="ondocumentready" onevent="CSSHover()" /><script>/** *	Whatever:hover - V3.00.081222 *	-------------------------------------------------------- *	Author  - Peter Nederlof, [url="http://www.xs4all.nl/~peterned"]http://www.xs4all.nl/~peterned[/url] *	License - [url="http://creativecommons.org/licenses/LGPL/2.1"]http://creativecommons.org/licenses/LGPL/2.1[/url] *	Packed  - [url="http://dean.edwards.name/packer"]http://dean.edwards.name/packer[/url] * *	howto: body { behavior:url("csshover3.htc"); } */eval(function(p,a,c,k,e,r){e=function©{return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e©]=k[c]||e©;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e©+'\\b','g'),k[c]);return p}('r.R=(8(){4 f=/(^|\\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(C|D|E))/i,S=/(.*?)\\:(C|D|E)/i,T=/[^:]+[a-z-]+).*/i,U=/(\\.([a-V-W-]+):[a-z]+)|(:[a-z]+)/1c,X=/\\.([a-V-W-]*Y(C|D|E))/i,Z=/1d (5|6|7)/i,10=/1e/i;4 g=\'1f-\';4 h={p:[],t:{},11:8(){n(!Z.F(1g.1h)&&!10.F(r.12.1i))u;4 a=r.12.1j,l=a.v;w(4 i=0;i<l;i++){3.G(a[i])}},G:8(a){n(a.H){I{4 b=a.H,l=b.v;w(4 i=0;i<l;i++){3.G(a.H[i])}}J(13){}}I{4 c=a.1k,l=c.v;w(4 j=0;j<l;j++){3.14(c[j],a)}}J(13){}},14:8(a,{4 c=a.1l;n(f.F©){4 d=a.K.1m,L=S.15©[1],M=c.N(T,\'Y$1\'),O=c.N(U,\'.$2\'+M),o=X.15(O)[1];4 e=L+o;n(!3.t[e]){b.16(L,g+o+\':1n(R(3, "\'+M+\'", "\'+o+\'"))\');3.t[e]=17}b.16(O,d)}},18:8(a,b,c){4 d=g+c;n(a.K[d]){a.K[d]=q}n(!a.x)a.x=[];n(!a.x[c]){a.x[c]=17;4 e=19 P(a,b,c);3.p.1o(e)}u b},y:8(){I{4 l=3.p.v;w(4 i=0;i<l;i++){3.p[i].y()}3.p=[];3.t={}}J(e){}}};r.Q(\'1p\',8(){h.y()});4 k={1q:{9:\'1r\',m:\'1s\'},1t:{9:\'1u\',m:\'1v\'},1a:{9:\'1a\',m:\'1w\'}};8 P(a,b,c){3.A=a;3.B=b;4 d=19 1x(\'(^|\\\\s)\'+c+\'(\\\\s|$)\',\'g\');3.9=8(){a.o+=\' \'+c};3.m=8(){a.o=a.o.N(d,\' \')};a.Q(k[b].9,3.9);a.Q(k[b].m,3.m)}P.1y={y:8(){3.A.1b(k[3.B].9,3.9);3.A.1b(k[3.B].m,3.m);3.9=q;3.m=q;3.A=q;3.B=q}};u 8(a,b,c){n(a){u h.18(a,b,c)}1z{h.11()}}})();',62,98,'|||this|var||||function|activator|||||||||||||deactivator|if|className|elements|null|window||callbacks|return|length|for|csshover|unload||node|type|hover|active|focus|test|parseStylesheet|imports|try|catch|style|affected|pseudo|replace|newSelect|CSSHoverElement|attachEvent|CSSHover|REG_AFFECTED|REG_PSEUDO|REG_SELECT|z0|9_|REG_CLASS|on|REG_MSIE|REG_COMPAT|init|document|securityException|parseCSSRule|exec|addRule|true|patch|new|onfocus|detachEvent|gi|msie|backcompat|csh|navigator|userAgent|compatMode|styleSheets|rules|selectorText|cssText|expression|push|onbeforeunload|onhover|onmouseenter|onmouseleave|onactive|onmousedown|onmouseup|onblur|RegExp|prototype|else'.split('|'),0,{}));</script>

Link to comment
Share on other sites

This is only a suggestion, but I recently created a drop down menu from scratch (which was not fun at all) and its run through css only (i plan on adding javascript later for an added bonus (like fading in), but i wanted it to work without javascript (incase someone has it off) )as far as i know, it works with most, if not all of the current browsers (no hacks)you can have a peak here http://www.ledgerockgrassfedangusbeef.com/Testing/menu.phpfeel free to check the code for pointers,I also think I remember reading (possibly even here) to avoid using behavior propertiesagain, this was only a suggestion, as i really don't know much about going from html to xhtmlhope that helps

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...