Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5

Différentes couleurs de background dans le sous-menu
#1

Citation :#~~~~~ NE PAS SUPPRIMER CE BLOC ~~~~~
#~ Version du CMS : 1.6.6
#~ Version du MLE si existante : Non
#~ Informations Système :
#~ ----------------------------------------------
#~ Cms Version: 1.6.6
#~ Installed Modules:
#~ * CMSMailer: 1.73.14
#~ * FileManager: 1.0.1
#~ * MenuManager: 1.6.2
#~ * ModuleManager: 1.3.1
#~ * News: 2.10.3
#~ * nuSOAP: 1.0.1
#~ * Printing: 1.0.4
#~ * Search: 1.6.1
#~ * ThemeManager: 1.1.1
#~ * TinyMCE: 2.6.2
#~ * CGExtensions: 1.17.9
#~ * Banners: 2.3.2
#~ * BlankOfTheMonth: 1.1
#~ Config Information:
#~ * php_memory_limit:
#~ * process_whole_template: false
#~ * max_upload_size: 10000000
#~ * default_upload_permission: 664
#~ * assume_mod_rewrite: false
#~ * page_extension:
#~ * internal_pretty_urls: false
#~ * use_hierarchy: true
#~ Php Information:
#~ * phpversion: 5.1.6
#~ * md5_function: On (Vrai)
#~ * gd_version: 2
#~ * tempnam_function: On (Vrai)
#~ * magic_quotes_runtime: Off (Faux)
#~ * memory_limit: 64M
#~ * max_execution_time: 90
#~ * safe_mode: Off (Faux)
#~ * session_save_path: Aucune vérification à cause de la restriction spécifiée par PHP open_basedir
#~ * session.use_cookies: On (Vrai)
#~ Server Information:
#~ * Server Api: apache2handler
#~ * Server Db Type: MySQL (mysql)
#~ * Server Db Version: 5.0.77
#~ ----------------------------------------------
#~~~~~ NE PAS SUPPRIMER CE BLOC ~~~~~
Bonjour,

J'ai un souci car je voudrais mettre plusieurs couleurs de background dans le sous-menu.

Je pense qu'il faudrait modifier le fichier "cssmenu_ulshadow.tpl" qui génère le menu dynamiquement, peut-être en ajoutant des conditions du style "si sous-menu 1 alors cette couleur, si sous menu 2 alors cette couleur, etc... Je voudrais définir 6 couleurs, ce qui permettra d'ajouter éventuellement 2 autres sous-menu par la suite (pour l'instant j'en ai 4).

Voici les codes du plus foncé au plus clair :
#4CBBE9, #7FCEEF, #B2E2F6, #CCECF9, #F2FAFD, #FFFFFF

Je suis nul en javascript et je ne sais pas comment faire... Sad

Voici le fichier tpl :
Code :
{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="unli">' times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
</li><li class="separator once" style="list-style-type: none;"> </li>
{repeat string='</ul>' times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
<li class="menuactive menuparent">
<a class="menuactive menuparent" {elseif $node->current == true}
<li class="menuactive">
<a class="menuactive" {elseif $node->haschildren == true}
<li class="menuparent">
<a class="menuparent" {elseif $node->type == 'sectionheader' and $node->haschildren == true}
<li class="sectionheader"><span class="sectionheader">{$node->menutext}</span>{else}
<li>
<a {/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
{if $node->target}target="{$node->target}" {/if}
href="{$node->url}"><span>{$node->menutext}</span></a>
{elseif $node->type == 'sectionheader'}
><span class="sectionheader">{$node->menutext}</span></a>
{/if}
{/foreach}
{repeat string='</li></ul>' times=$node->depth-1}
</li>
</ul>
<div class="clearb"></div>
</div>
{/if}
Le css :
Code :
@charset "utf-8";
/* CSS Document */
#menu_vert {
/* no margin/padding so it fills the whole div */
    margin: 0;
    padding: 0;
        outline: none;
}
.clearb {
/* needed for some browsers */
    clear: both;
}
#menuwrapper {
/* set the background color for the menu here */
    background-color: #fff;
/* IE6 Hack */
    height: 1%;
    width: auto;
    margin-top: 0px;
    padding: 0;
}
ul#primary-nav {
    list-style-type: none;
    margin: 0px;
    padding-top: 0px;
    padding-left: 20px;
}
ul#primary-nav ul.unli ul.unli li span {
     font-weight:normal;
     padding-left : 20px;
}

ul#primary-nav li.menuparent ul.unli li a span {
     padding-bottom : 0.1em;
}
#primary-nav ul {    
    background-color: #a2daf3;
    /* remove any default bullets */
    list-style-type: none;
/* sets width of second level ul to background image */
/*    width: 210px;*/
        margin: 0px;
    padding-left: 0px;
        padding-bottom: 5px;

/* make the ul stay in place so when we hover it lets the drops go over the content instead of displacing it */
    position: absolute;
/* Pour que le sous-menu ne soit pas caché par le slideshow */
        z-index: 1000;
/* top being the bottom of the li it comes out of */
    top: auto;
/* keeps it hidden till hover event */
    display: none;
/* room at top for li so image top shows correct */
    padding-top: 9px;
}
/* IE6 hacks on the above code */
* html #primary-nav ul {
    padding-top: 13px;
}
#primary-nav ul ul {
/* pour que les sous sous-menu soient en dessous des sous-menus */
    position:static;
/* insures no top margins */
    margin-top: 0px;
/* pulls the last ul back over the preceding ul */
    margin-left: -1px;
/* negative margin pulls the left centered in li next to it */
    top: -3px;
}
/* IE6 hacks on the above code */
* html #primary-nav ul ul {
    margin-top: 0px;
    padding-left: 5px;
    top: -7px;
}
#primary-nav li {
/* a little space to the left of each top level menu item */
    margin-left: 0px;
/* floating left will set menu items to line up left to right else they will stack top to bottom */
    float: left;
}

#primary-nav li li {
/* a little more space to the left of each menu item */
    margin-left: 8px;
/* keeps them tight to the one above, no missed hovers */
    margin-top: -1px;
/* removes the left float set in first li so these will stack from top down */
    float: none;
/* relative to the ul they are in */
    position: relative;

margin-bottom: -2px;


}
/* IE6 hacks on the above code */
* html #primary-nav li li {
    margin-left: 6px;
/* helps hold it inside the ul */
    width: 171px;
}
ul#primary-nav li a {
/* specific font size, this could be larger or smaller than default font size */
    font-size: 1em;
/* make sure we keep the font normal */
    font-weight: normal;
/* set default link colors */
    color: #666;
/* doing tab menus require a bit different padding, this will give room on right for image to show, adjust to width of your image */
    padding: 0px 11px 0px 0px;
/* makes it hold a shape */
    display: block;
/* remove default "a" underline */
    text-decoration: none;
}
ul#primary-nav li a span {
/* takes normal "a" padding minus some for right image */
    padding: 12px 4px 12px 15px;
/* makes it hold a shape */
    display: block;
}
ul#primary-nav li a:hover {
/* kind of obvious */
    background-color: transparent;
}
ul#primary-nav li span {
/* set text color here also to insure color */
    color: #666;
/* just to be sure */
    font-weight: bold;
}
ul#primary-nav li li {
/* remove any image set in first level li */
    background:  none;
}
ul#primary-nav li li span {
/* remove any image set in first level li span */
    background:  none;
/* set text color here also to insure color */
    color: #666;

/* just to be sure */
/*font-weight: normal;*/

}
ul#primary-nav li:hover,
ul#primary-nav li.menuh,
ul#primary-nav li.menuparenth {
background-color: #ffff00;
}
ul#primary-nav li:hover span,
ul#primary-nav li.menuh span,
ul#primary-nav li.menuparenth span {
     background-color: #ffff00;
/* change text color on hover */
    color: #666;
/*    font-weight: bold;*/
}
/* IE6 hacks, the JS used for hover effect in IE6 puts class menuh on li, unless they have a class then just an "h" as seen above and below */
ul#primary-nav li li.menuh {
    background:  none;
    font-weight: normal;
}
/* IE6 hacks */
ul#primary-nav li.menuparenth li span {
    background:  none;
    color: #666;
    font-weight: normal;
}
/* IE6 hacks */
ul#primary-nav li.menuparenth li.menuparent span {
/* gif for IE6, as it can't handle transparent png */
/*    background:  url(uploads/ngrey/parent.gif) no-repeat right center;*/
    color: #666
}
/* IE6 hacks */
ul#primary-nav li.menuparenth li.menuh span {
    background:  none;
    color: #666;
    font-weight: normal;
}
/* IE6 hacks */
ul#primary-nav li.menuparenth li.menuparenth {
    background:  none;
    color: #666;
    font-weight: normal;
}
ul#primary-nav li.menuactive a {
background-color: #ffff00;
}



ul#primary-nav li a.menuactive span {
background-color: #ffff00;
    color: #666;
}
#primary-nav li li a {
/* second level padding, no image and not as big */
/*    padding: 5px 10px;*/
    padding: 0px;
/* to keep it within li */
    width: 175px;
/* space between them */
        margin: 5px;
    background: none;
}
/* IE6 hacks to above code */
* html #primary-nav li li a {
/*    padding: 5px 10px;*/
    padding: 0px;
    width: 165px;
    margin: 0px;
    color: #666;
}
#primary-nav li li:hover {
/* remove image set in first level */
    background: none;
}
#primary-nav li li a:hover {
    color: #666;
}
#primary-nav li.menuparent li a:hover span {
/* insures text color */
/*color: #000;*/
background:  url(uploads/ngrey/parent.gif) no-repeat left center;
}


#primary-nav li li.menuactive a.menuactive, #primary-nav li li.menuactive a.menuactive:hover {
/*    color: #666;*/
/*font-weight: bold;*/
}
#primary-nav li li.menuactive a.menuactive span {
/*    color: #666;*/
font-weight: bold;
}
#primary-nav li li.menuactive a.menuactive:hover span {
/*color: #000;*/
/*font-weight: bold;*/
}



/* IE6 hacks to above code */
#primary-nav li li.menuparenth a.menuparent span {
/* right arrow for menu parent, IE6 gif */
/*    background:  url(uploads/ngrey/parent.gif) no-repeat right center;*/
    color: #666;
}
/* IE6 hacks to above code */
#primary-nav li li.menuparenth a.menuparent:hover span {
    color: #666;
}
#primary-nav li li.menuparent a.menuparent span {
/* Pour supprimer l'espace du 1er sous sous-menu */
    float: left;
        font-weight: bold;
}
#primary-nav li.menuactive li a:hover span {
/* black text */
/*color: #000;*/
}
ul#primary-nav li li a.menuactive  span {
/* remove image set in first level */
    background:  none;
    font-weight: normal;
}
#primary-nav li.menuactive li a {
/* second level active link color */
    color: #666;
    text-decoration: none;
    background: none;
}
#primary-nav li.menuactive li a:hover span {
/*color: #000;*/
}
ul#primary-nav li:hover li a span {
    padding: 0 0 0 15px;
    background:  none;
    color: #666;
}
ul#primary-nav li.menuparenth li a span {
    padding: 0 0 0 15px;
    background:  none;
}
/* for fourth level add
#primary-nav ul ul ul li:hover ul,
#primary-nav ul ul ul li.menuparenth ul,
*/
#primary-nav li:hover ul,
#primary-nav ul li:hover ul,
#primary-nav ul ul li:hover ul,
#primary-nav li.menuparenth ul,
#primary-nav ul li.menuparenth ul,
#primary-nav ul ul li.menuparenth ul {
    display: block;
}
/* IE Hacks */
#primary-nav li li {
    float: left;
    clear: both;
}
#primary-nav li li a {
    height: 1%;
}
Et le menu actuel :


Je suis désespéré je n'y arrive pô...

Serait-il possible de le faire uniquement en css ?

Merci d'avance pour votre votre aide Smile
Répondre


Messages dans ce sujet

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)