|
|
|
|
Bonsoir,
le html me semble correct. Pourrais-tu me montrer ton javascript ? Je ne peux pas t'aider si je ne l'ai pas. |
Bonjour et merci :)
En fait, je ne sais pas du tout quoi ajouter pour avoir un "sous-sous-menu". Par exemple lorsque je pointe sur "Lien1" un autre sous-menu s'affiche. J'ai essayer plusieurs choses sans succès. ------------------------------ Voilà le javascript : window.onload=montre(); var timer; function montre(id) { window.clearTimeout(timer); var d = document.getElementById(id); for (var i = 1; i<=20; i++) { if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';} } if (d) {d.style.display='block'; timer=window.setTimeout("montre()", 10000);} } ------------------------------ Et le CSS : #menu { position:absolute; top:0px; left:0px; margin:0; padding:0; display:block; } #menu .titre-rubrique { margin:0 0 1px 1px; padding:0; width:222px; display:block; text-align:left; } .rubriques { position:absolute; top:0; left:0; margin:0; padding:0; } .rubriques li a.btn1 { position:relative; margin-bottom:0; padding:0 0 0 0; display:block; width:190px; height:27px; overflow:hidden; font:0.71em Arial, Helvetica, sans-serif; font-weight:normal; color:#D1DBDF; text-align:left; text-transform:uppercase; background-image:url(_images/menu/btn1.gif); background-repeat:no-repeat; background-position:top center; } .rubriques li a.btn2 { position:relative; margin-bottom:0; padding:0 0 0 0; display:block; width:190px; height:27px; overflow:hidden; font:0.71em Arial, Helvetica, sans-serif; font-weight:normal; color:#D1DBDF; text-align:left; text-transform:uppercase; background-image:url(_images/menu/btn2.gif); background-repeat:no-repeat; background-position:top center; } .rubriques li a:hover.btn1 { height:27px; overflow:hidden; font:0.71em Arial, Helvetica, sans-serif; color:#FFF; text-decoration:none; background-image:url(_images/menu/btn1_over.gif); background-repeat:no-repeat; background-position:bottom center; } .rubriques li a:hover.btn2 { height:27px; overflow:hidden; font:0.71em Arial, Helvetica, sans-serif; color:#FFF; text-decoration:none; background-image:url(_images/menu/btn2_over.gif); background-repeat:no-repeat; background-position:bottom center; } .rubriques li div { position:relative; top:0; left:0; padding:0; } .rubriques div { position:absolute; } .rubriques ul { position:absolute; top:-32px; left:190px; margin:0; padding:0; border-bottom:1px solid #142D35; } .rubriques div a, .rubriques div a:visited{ margin-bottom:-2px; padding:8px 10px 4px 16px; display:block; width:210px; height:auto; font:0.71em Arial, Helvetica, sans-serif; text-decoration:none; color:#FFF; text-transform:uppercase; background-image:url(_images/menu/fd_s-bouton.png); background-repeat:repeat; filter: Alpha(Opacity=85); border:1px solid #142D35; border-left:4px solid #142D35; } html>body .rubriques div a { margin-bottom:-1px; } .rubriques div a:hover{ color:#142D35; text-decoration:none; background-color:#FFF; background-image:none; filter: Alpha(Opacity=100); border:1px solid #142D35; border-left:4px solid #000000; } .rubriques li a.titre, .rubriques li a:visited.titre{ margin-bottom:-2px; padding:8px 10px 4px 16px; display:block; width:210px; height:auto; font:0.71em Arial, Helvetica, sans-serif; text-decoration:none; color:#FFF; text-transform:uppercase; text-align:center; background-color: #142D35; filter: Alpha(Opacity=85); border:1px solid #142D35; } |
|
Ixion,
je vais te proposer une solution bricolée à partir de tes codes. Mais pour plus de souplesse, il faudrait créer une fonction javascript qui soit plus adaptée au multi-niveaux, comme celle du site que tu sites en exemple. Reste à l'écoute. |
Bonjour,
J'ai trouvé une fonction que je devrais pouvoir adapter à mon cas : <script type="text/javascript"> sfHover = function() { var sfEls = document.getElementById("nav").getElementsByTagName("LI"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); </script> Merci de te pencher sur mon problème :) |
|
SALUT
en voila un sans javascript !! adapte le a tes besoins , j ai mis des sub menu et meme un sub sub ! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>rad zone webcreation </title> <meta name="author" content="http://radservebeer.free.fr" /> <meta name="generator" content="pspad editor, www.pspad.com" /> <style type="text/css">/* <![CDATA[*/ body { background-color: #333; } .rad3.rad4.rad5.rad6.rad7.menu { margin: 10px; height: 100px; font-size: 12pt; font-family: roman; } .menu ul { margin: 0pt; padding: 0pt; position: relative; z-index: 500; list-style-type: none; width: 11em; } .menu li { background-color: #cccc99; float: left; } .menu li.sub { background-color: #cccc99; } .menu table { position: absolute; border-collapse: collapse; top: 0pt; left: 0pt; z-index: 100; font-size: 1em; margin-top: -1px; } .menu a, .menu a:visited { border: 1px solid #ffffff; display: block; text-decoration: none; height: 2em; line-height: 2em; width: 11em; color: #000000; padding-left: 1em; font-weight: normal; font-style: normal; font-variant: normal; text-transform: none; } .menu b { float: right; margin-right: 5px; } * html .menu a, * html .menu a:visited { width: 11em; } * html .menu a:hover { color: #ccff66; background-color: #999966; position: relative; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; text-transform: none; } .menu li:hover { position: relative; } .menu a:active, .menu a:focus { color: #ccff66; background-color: #999966; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; text-transform: none; } .menu li:hover > a { color: #ccff66; background-color: #999966; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; text-transform: none; } .menu li ul { padding: 2em; visibility: hidden; position: absolute; top: -2em; left: 7em; background-color: transparent; } .menu li:hover > ul { visibility: visible; } .menu ul a:hover ul ul { visibility: hidden; } .menu ul a:hover ul a:hover ul ul { visibility: hidden; } .menu ul a:hover ul a:hover ul a:hover ul ul { visibility: hidden; } .menu ul a:hover ul { visibility: visible; } .menu ul a:hover ul a:hover ul { visibility: visible; } .menu ul a:hover ul a:hover ul a:hover ul { visibility: visible; } .menu ul a:hover ul a:hover ul a:hover ul a:hover ul { visibility: visible; }/*]]>*/ </style> </head> <body> <div class="menu"> <ul><li> <a href="#"><b>»</b>Item <!--[if IE 7]> <!--></a> <!--<![endif]--> <!--[if lte IE 6]> <table> <tr> <td> <![endif]--> <ul><li> <a href="#">S1</a></li><li> <a href="#"><b>»</b>S1A <!--[if IE 7]> <!--></a> <!--<![endif]--> <!--[if lte IE 6]> <table> <tr> <td> <![endif]--> <ul><li> <a href="#">SS1</a></li><li> <a href="#">SS2 <!--[if IE 7]> <!--></a> <!--<![endif]--> <!--[if lte IE 6]> <table> <tr> <td> <![endif]--></li> </ul> <!--[if lte IE 6]> </td> </tr> </table> </a> <![endif]--></li> </ul> <!--[if lte IE 6]> </td> </tr> </table> </a> <![endif]--></li><li> <a href="#"><b>»</b>2 <!--[if IE 7]> <!--></a> <!--<![endif]--> <!--[if lte IE 6]> <table> <tr> <td> <![endif]--> <ul><li> <a href="#">S2</a></li> </ul> <!--[if lte IE 6]> </td> </tr> </table> </a> <![endif]--></li><li> <a href="#">3</a></li><li> <a href="#">4</a></li> </ul> </div> </body> </html> ♣ La plus grande erreur que puisse faire un homme est d'avoir peur d'en faire une. ♣ |
Merci Rad Zone ! Je n'ai pas encore eu le temps de tester, mais ces menus ont l'air très intéressants. Je m'y mets tout de suite.
Groarh avait aussi une proposition, je peux essayer les deux pour voir. @+ et merci :) |
Ixion,
quand j'ai vu la rapidité avec laquelle Rad Zone a posté une solution, j'ai laissé tomber de mon côté, désolé. |
Résultats pour Un menu CSS vertical multi niveaux
Résultats pour Un menu CSS vertical multi niveaux
Résultats pour Un menu CSS vertical multi niveaux
Résultats pour Un menu CSS vertical multi niveaux
Résultats pour Un menu CSS vertical multi niveaux
Résultats pour Un menu CSS vertical multi niveaux
Résultats pour Un menu CSS vertical multi niveaux