Partage
  • Partager sur Facebook
  • Partager sur Twitter

Rendre un menu dynamique au clic de la souris

    6 août 2018 à 15:56:10

    Bonjour,

    en tant que débutant en css je ne parviens pas à modifier mon script pour rendre un menu de navigation dynamique.

    Je m'explique : j'ai récupéré un template Joomla en licence GNU sur lequel le menu vertical de gauche est fixe, c'est-à-dire qur toutes les rubriques et sous-rubriques apparaissent tout le le temps. Je voudrais modifier de menu pour que les sous-rubriques de niveaux 2 et 3 soient cachées et qu'elles n'apparaissent qu'au clic de la souris.

    J'ai tenté de modifier des lignes du type display: block; en display: none; mais rien n'y fait.

    Je joins le code css concerné, si quelqu'un peut me donner un coup de main.

    Merci !

    /**
     * @version $Id: template.css
     * @author SiteGround
     * @package Joomla
     * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
     * @license GNU/GPL, see LICENSE.php
     * Joomla! is free software. This version may have been modified pursuant to the
     * GNU General Public License, and as distributed it includes or is derivative
     * of works licensed under the GNU General Public License or other free or open
     * source software licenses. See COPYRIGHT.php for copyright notices and
     * details.
     */
    body,html {height:100%;}
    body{background:#ffffff;font: 400 12px/1.3em Arial, Tahoma, Verdana, Helvetica;color:#777;margin:0;padding:0}
    .clr{clear:both;overflow:hidden;font-size:0;line-height:0;}
    ul{list-style:none;margin:0;padding:0}
    a,img{outline:none;margin:0;padding:0;border:none;}
    a:link, a:visited { color:#777;text-decoration:none;}
    a:hover, a:active, a:focus { color:#333; }
    form { padding:0;margin:0; }
    header, nav, section, aside, article, footer { display:block; }
    menu { display:none; }
    
    h1,h2,h3,h4,h5,h6 { margin:0 0 20px;font-family: 'Droid Serif', serif; color:#666;line-height:normal; }
    
    h1 { font-size:24px;}
    h2 { font-size:20px; color:#333;}
    h3 { font-size:18px; color:#333;font-family: 'PT Sans Narrow', serif;}
    h4 { font-size:14px;}
    h5 { font-size:12px;}
    h6 { font-size:11px;}
    
    iframe {border:none;}
    dl dd {
    	padding:0 0 0 10px;
    	margin:0;
    }
    
    fieldset { border:none;margin:0;padding:0;}
    input, textarea, button { border: none;background:#BDD8F8;color:#0075FF;}
    button {  background: url("../images/but.gif") repeat-x scroll left top transparent;color:#fff;border:none; }
    
    p { margin:0 0 10px; }
    
    .page_bg {
    	background: url("../images/page_bg.png") repeat-x scroll left top #FFFFFF;
    }
    
    #wrapper {
        background: url("../images/wrapper.jpg") no-repeat scroll center top transparent;
    }
    
    .page { min-height: 100%; }
    
    .wrapper { padding-bottom: 140px; }
    
    .main { width:960px;margin:0 auto; }
    .top { margin:0 auto;width:960px;height:38px}
    .top .menu { height:26px;padding:6px 0;}
    .top .menu li { float:left;height:26px;margin:0 10px 0 0;font-size:12px;}
    .top .menu a { float:left;background: transparent url(../images/top_menu_r_bg.png) no-repeat top right;text-decoration:none;}
    .top .menu a span { float:left;height:26px;padding:0 10px;color:#fff;line-height:25px;background: transparent url(../images/top_menu_l_bg.png) no-repeat top left;cursor:pointer;}
    
    
    header {
        background: url("../images/headerimg.jpg") no-repeat scroll center top transparent;
        height: 310px;
        margin: 0 auto;
        padding: 10px 0 0;
        position: relative;
        width: 960px;
    }
    
    header .logo {
        float: right;
        height: 50px;
        overflow: hidden;
        padding: 0 80px 0 0;
        width: 380px;
    }
    
    header .logo table tr td {
        height: 50px;
        overflow: hidden;
        vertical-align: middle;
        width: 380px;
    }
    
    header h1 { 
        color: #47A423;
        line-height: normal;
        margin: 0;
        padding: 0;
        text-align: center;
        text-transform: uppercase;
        font-family: Tahoma;
    }
    header h1 a, header h1 a:link, header h1 a:visited, header h1 a:hover {
        color: #000000;
        font-size: 20px;
        font-weight: 700;
        text-decoration: none;
    }
    
    header table, header table th, header table td {border: none !important;}
    header table { width: 100%; }
    header table td { height: 80px;vertical-align: middle; }
    
    
    #search {
        bottom: 30px;
        left: 8px;
        position: absolute;
        overflow: hidden
    }
    
    #search .search {
        background: url("../images/inputbox.png") no-repeat scroll left bottom transparent;
        float: left;
        height: 22px;
        padding: 0 0 0 6px;
        width: 197px;
    }
    
    #search .search .inputbox {
        background: none repeat scroll 0 0 transparent;
        border: medium none;
        color: #696969;
        float: left;
        font-size: 11px;
        height: 16px;
        line-height: 16px;
        padding: 2px 6px 4px 0;
        width: 190px;
    }
    
    #search .search .button {
    	display: none;
        float: right;
        font-size: 0;
        height: 0;
        line-height: 0;
    }
    
    .top-menu {
        bottom: 106px;
        height: 26px;
        margin: 0 auto;
        position: absolute;
        right: 0;
        width: 750px;
    }
    
    .maincol,
    .maincol_w_right,
    .maincol_w_left,
    { padding: 0;width: 968px;margin: 0 auto; }
    
    .maincol_full {
    	margin-left: 6px;
    	padding: 0 0 10px;
        width: 960px;
    }
    
    .leftcol { float:left;margin: 0 10px 0 0;width: 214px; }
    .rightcol { float:left;margin: 0 0 0 10px;width: 214px; }
    
    .maincol_w_right .cont,
    .maincol_w_left .cont {
        float: left;
        padding: 6px 0 0 5px;
        width: 720px;
    }
    
    .maincol_w_right .cont {
    	padding: 6px 0 0 19px;
    }
    
    .maincol .cont {
        float: left;
        padding: 0 10px;
        width: 500px;
    }
    
    .content_m {
    	width:980px;
    	background: transparent url(../images/content_m.png) repeat-y top center;
    }
    	
    .content_b  {
    	width:980px;
    	background: transparent url(../images/content_b.png) no-repeat bottom center;
    }
    
    .content_t {
    	width:980px;
    	background: transparent url(../images/content_t.png) no-repeat top center;
    }
    
    .content_t_l {
    	width:968px;
    	background: transparent url(../images/content_t_l.png) no-repeat top center;
    }
    
    .content_t_r {
    	width:968px;
    	background: transparent url(../images/content_t_r.png) no-repeat top center;
    }
    
    .content_t_full {
    	width:930px;
    	margin: 0 0 0 20px;
    	background: transparent url(../images/content_t_full.png) no-repeat top center;
    }
    
    .content_b_l  {
    	width:968px;
    	background: transparent url(../images/content_b_l.png) no-repeat bottom center;
    }
    
    .content_b_r  {
    	width:968px;
    	background: transparent url(../images/content_b_r.png) no-repeat bottom center;
    }
    
    .content_b_full  {
    	width:968px;
    	background: transparent url(../images/content_b_full.png) no-repeat bottom center;
    }
    
    .content_m_l {
    	margin-left:6px;
    	width:968px;
    	background: transparent url(../images/content_m_l.png) repeat-y top center;
    }
    
    .content_m_r {
    	width:968px;
    	margin-left:6px;
    	background: transparent url(../images/content_m_r.png) repeat-y top center;
    }
    
    .content_m_full {
    	width:968px;
    	background: transparent url(../images/content_m_full.png) repeat-y top center;
    }
    
    
    #breadcrumbs { position:absolute;bottom:30px;left:0;}
    
    .separator { font-size:12px;padding:20px 0 0;display:block;color:#505050;font-size:12px;font-weight:700; }
    
    
    .module_menu .menu,
    .module .menu
    { margin:0 20px 0 10px; }
    
    .module_menu .menu li,
    .module .menu li
    { padding:0 0 0 10px;line-height:20px;}
    
    .module_menu .menu li a,
    .module .menu li a
    { display:block;}
    
    .module_menu .menu li a span,
    .module .menu li a span
    { display:block;padding:0;background: transparent url(../images/arrow1.gif) no-repeat left 7px;cursor:pointer;}
    
    #login-form {
    	margin:0;
    	padding:0;
    }
    
    fieldset.userdata {
    	border:none;
    	margin:0 20px;
    	padding:0;
    	height:150px;
    	position:relative;
    }
    
    #login-form ul { margin:20px 20px 0; }
    
    fieldset.userdata label {display:block;line-height:16px; }
    #form-login-remember label { display:inline; }
    
    fieldset.userdata input { background:#BDD8F8;color:#0075FF;border:none; }
    fieldset.userdata input.button { position:absolute;bottom:0;left:0;width:80px;}
    
    
    fieldset.userdata input.button {
        background: url("../images/but.gif") repeat-x scroll left top transparent;
        color: #CCCCCC;
        float: left;
        font-weight: 400;
        height: 20px;
        line-height: 15px;
        margin: 10px 0 0;
        padding: 0 10px 3px;
    }
    
    #form-login-username,
    #form-login-password,
    #form-login-remember { margin:0 0 10px;overflow:hidden; }
    
    #modlgn-remember { float:none;margin:0 0 0 10px;border:none;background:none;width:auto; }
    
    
    .module .search { margin: 0 20px;position:relative; }
    .search label { display:none; }
    #mod-search-searchword {
    	border:1px solid #d5d5d5;background:none;color:#666;width:160px;
    }
    .module .search .button { position:absolute;right:0;top:0;text-indent:-9999px;width:20px;height:20px;background: transparent url(../images/search_bg.png) no-repeat center center;}
    
    div.module_menu div, div.module div, div.module_text div {
        background: url("../images/box_m.gif") repeat-y scroll center top transparent;
    }
    
    div.module_menu div div, div.module div div, div.module_text div div {
        background: url("../images/box_b.gif") no-repeat scroll center bottom transparent;
        margin: 0 0 20px;
        padding: 0 0 2px;
    }
    
    div.module_menu div div div, div.module div div div, div.module_text div div div {
        background: url("../images/box_t.gif") no-repeat scroll center top transparent;
        margin: 0;
    }
    
    div.module_menu div div div div, div.module div div div div, div.module_text div div div div {
    	background: none;
    	
    }
    
    .userdata { padding: 0 0 0 10px !important; }
    
    div.module_menu div div div div.custom, div.module div div div div.custom, div.module_text div div div div.custom {
    	padding: 0 20px;
    	text-align: justify;
    }
    
    .leftcol ul.menu,
    .rightcol ul.menu {
    	padding: 0 0 0 12px;
    }
    
    .leftcol h3, .rightcol h3 {
        background: url("../images/box_h3.png") no-repeat scroll left top transparent;
        color: #FFFFFF;
        font-size: 11px;
        font-weight: 700;
        height: 26px;
        line-height: 25px;
        margin: 0 0 8px;
        overflow: hidden;
        padding: 0 12px;
        text-align: left;
        text-transform: none;
        width: 190px;
        font-family: Tahoma;
    }
    
    .rightcol h3 {
        background: url("../images/box_h3_r.png") no-repeat scroll right top transparent;
    }
    
    .leftcol ul.menu li a, .leftcol ul.menu li a:link,
    .leftcol ul.latestnews li a, .leftcol ul.latestnews li a:link,
     .rightcol ul.menu li a, .rightcol ul.menu li a:link,
    .rightcol ul.latestnews li a, .rightcol ul.latestnews li a:link {
        background: url("../images/menu_arrow.gif") no-repeat scroll left top transparent;
        color: #0075FF;
        display: block;
        font-size: 11px;
        font-weight: 400;
        line-height: 17px;
        margin: 0;
    	padding: 0 12px 0 18px;
        text-decoration: none;
    }
    
    ul.latestnews {margin: 0 0 0 12px;}
    
    .leftcol ul.menu li a:hover {
    	color: #000080;
    }
    
    /* maincol */
    .maincol h2,
    .maincol h2 a {
    	color:#0075FF;
      	font-size: 26px;
      	line-height:normal;
      	margin:0 0 10px;
    }
    
    .items-leading,
    .category-desc
    {
    	margin:0 0 20px;
    }
    
    /* items row */
    .items-row .item {
    	margin:0 0 30px 0;text-align:justify; background:#f2f2f2;padding:10px;
    	border:1px solid #ccc;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
    }
    .items-row .item h2,
    .items-row .item h2 a { font-size:18px;}
    .item .readmore { text-align:right;margin:0;}
    .item .readmore a { color:#4e8f0c;font-weight:700; }
    
    
    .actions { overflow:hidden;margin:0 0 10px;}
    .actions li { float:left; }
    .actions li img { float:left;margin:0 6px 0 0; }
    
    
    .category-desc img { margin:0 10px 4px }
    .category-desc a, .category-desc a:link, .category-desc a:visited { color:#333;text-decoration:underline;}
    .image-left { float:left;margin:0 10px 4px 0; }
    .image-right { float:left;margin:0 0 4px 10px; }
    
    
    .item-title { font-size:12px; }
    .main .categories-list ul li {
        padding: 5px;
    }
    
    .category-desc {
        line-height: 1.7em;
        margin: 10px 0;
        padding-left: 0;
    }
    
    .category-desc p { line-height:40px; }
    .pagination { overflow:hidden;padding:10px 0; }
    .pagination .counter { margin:0; }
    
    .current > a > span {
    	color:#000000;
    }
    
    .pagination ul { overflow:hidden;}
    .pagination ul li {
    	float:left;
    	margin:0 6px 0 0;
    }
    
    .pagination .pagenav {
    	display:block;
    	background:#fff;
    	margin:0 4px 0 0;padding:2px 6px;
    	border:1px solid #e5e5e5;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
        margin:10px 0;
    }
    
    
    .pagenav .pagenav-prev { float:left; }
    .pagenav .pagenav-next { float:right; }
    .pagenav-prev, .pagenav-next {
    	background:#fff;
    	margin:0 4px 0 0;padding:2px 6px;
    	border:1px solid #e5e5e5;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
        margin:10px 0;
    }
    
    /* end maincol */
    
    /* tables */
    
    table { border-collapse:collapse }
    
    table, table th, table td { border:solid 1px #d5d5d5 !important }
    
    
    table.weblinks th,
    table.newsfeeds th,
    table.category th,
    table.jlist-table th
    {
    	background:#dedede;
    	color:#777
    }
    
    
    table.weblinks,
    table.category
    { margin:10px 10px 20px 0px;width:99%; }
    
    table.weblinks td
    { border-collapse:collapse; }
    
    table.weblinks td,
    table.category td
    { padding:7px; }
    
    table.weblinks th,
    table.category th
    { padding:7px;text-align:left }
    
    td.num
    { vertical-align:top;text-align:left; }
    
    td.hits
    { vertical-align:top;text-align:center }
    
    td p
    { margin:0;line-height:1.3em }
    
    .filter
    { margin:10px 0 }
    
    .display-limit,
    .filter
    { text-align:right;margin-right:7px }
    
    /* ++++++++++++++  category table  ++++++++++++++ */
    
    table.category th a img
    { padding:2px 10px }
    
    .filter-search
    { float:left; }
    .filter-search .inputbox
    {width:6em}
    
    legend.element-invisible
    {
            position:absolute;
            /* need margin top and left doesn't work for the legend element */
            margin-left:-3000px;
            margin-top:-3000px;
            height:0px;
    }
    
    .cat-items
    { margin-top:20px }
    
    #contact-slider .panel {
    	background:#fff;
    	margin:0 0 10px 0;
    	padding:10px;
    	border:1px solid #e5e5e5;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
        margin:10px 0;
    }
    
    #contact-slider .panel h3 { margin:0; }
    #contact-slider .panel h3 a { font-size:18px;line-height:normal; }
    #contact-slider .panel .pane-slider { padding:10px 0 0 0; }
    #contact-slider .panel .pane-slider div { padding:10px 0 0 0;overflow:hidden; }
    
    .contact-email label
    { float:left;width:140px; }
    
    #member-registration label { display:block; }
    #member-registration legend { font-size:20px; }
    
    #member-registration dd { padding:0;margin:0 0 10px; }
    
    .contact-links li { line-height:20px; }
    
    
    /* */
    #jform_email-lbl { width:200px;float:left; }
    #article-index li { line-height:20px; }
    
    .maincol li {line-height:20px;}
    .maincol .menu li,
    #article-index li,
    .maincol .latestnews li,
    .maincol .relateditems li,
    .maincol .categories-module li
    {
    	padding:0 10px 0 4px;
    	line-height:20px;
    	background: transparent url(../images/arrow-1.png) no-repeat top left;
    }
    
    #article-index ul,
    .maincol .menu { margin:10px 0; }
    
    .stats-module dt {
        float: left;
        font-weight: bold;
        margin: 0 10px 0 0;
    }
    
    .maincol .login,
    .maincol .registration,
    #user-registration {
    	background:#F2F2F2;
    	margin:0 0 10px 0;
    	padding:20px 80px 20px 20px;
    	border:1px solid #ccc;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
        margin:0 0 10px 0;
    }
    
    .maincol .login label { float:left;width:100px;}
    .maincol .login .login-fields {overflow:hidden;margin:0 0 10px;}
    
    footer {
        background: url("../images/news_bg.jpg") no-repeat scroll center bottom transparent;
        color: #777777;
        height: 50px;
        line-height: 50px;
        margin: 0 auto;
        overflow: hidden;
        padding: 6px 10px;
        text-align: center;
        width: 940px;
    }
    footer p { margin: 0;color: #777777;}
    footer a, footer a:link, footer a:visited, footer a:hover { color:#777777;}
    
    .error {
    	background:#fdcdc9;
    	margin:0 0 20px 0;
    	padding:10px;
    	border:none;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
    }
    
    #system-message { margin:0; }
    #system-message dt.warning{ color:#be4e4c;margin:0 0 10px;font-size:16px;font-weight:700; }
    #system-message dd.warning li { line-height:20px;background: transparent url(../images/arrow-2.png) no-repeat left top;padding:0 0 0 20px; }
    
    .tip-wrap {
    	background:#fff;
    	margin:0 0 10px 0;
    	padding:10px;
    	border:1px solid #e5e5e5;
    	border-radius: 5px;
    	-o-border-radius: 5px;
    	-moz-border-radius: 5px;
    	-webkit-border-radius: 5px;
    }
    
    /* sgmenu */
    #sgmenu ul.menu:after { clear: both;content: "";display: block; }
    #sgmenu ul.menu { _zoom: 1;float: right; }
    #sgmenu ul li { float: left;margin-right: 10px;}
    #sgmenu ul li a { display: block;white-space: nowrap }
    #sgmenu ul li ul { position: absolute;visibility: hidden;}		
    #sgmenu ul li ul li { float: none;}
    #sgmenu ul li ul li a { width: auto; }
    
    
    /* sgmenu skin */
    #sgmenu { margin: 0;height: 27px;}
    #sgmenu ul.menu li a,#sgmenu ul.menu li a:link, #sgmenu ul.menu li a:visited { 
    text-align:center;line-height:27px; font-weight:700; 
    display: inline-block;
        color: #0075FF;
        cursor: pointer;
    }
    #sgmenu ul.menu li a span {
    	display: block;
    	padding:0 10px;
            background: url("../images/t_menu_btn.png") no-repeat scroll left bottom transparent;
        padding: 0 10px 0 16px;
        color: #0075FF;
        float: left;
        font-family: Tahoma,Verdana,Arial,sans-serif;
        font-size: 11px;
        height: 27px;
        line-height: 27px;
        text-decoration: none;
    }
    #sgmenu ul.menu ul li a:hover { color: #328910; }
    #sgmenu ul.menu li ul li a:hover { color: #328910 }
    
    
    #sgmenu ul.menu ul li a span {
    	color: #0075FF;
    	font-size:12px;
    	font-weight:700;
    	font-family:Trebuchet Ms, Tahoma, Verdana, Arial, sans-serif;
    	text-decoration: none;
    	line-height:25px;
    }
    
    #sgmenu ul.menu li a:hover,#sgmenu ul.menu li#current a{
    	background: transparent url(../images/t_menu_btn_r_hover.png) no-repeat top right;
    }
    
    #sgmenu ul.menu li a:hover span,#sgmenu ul.menu li#current a span{
    	color:#328910;
    	background: transparent url(../images/t_menu_hover.png) no-repeat left bottom;
    }
    
    #content {
        background: url("../images/content_m.gif") repeat-y scroll center top transparent;
        margin: 0 auto;
        width: 980px;
        
    }input.inputbox, textarea.inputbox  {background: #ebebeb; background: 1px solid #a3a3a3; margin: 0 0 10px 0; color: #000;}
    .input-small { display: block; margin: 2px 0 15px 0;}
    .control-group { margin: 0 0 0 10px !important; }
    btn { margin: 20px 0 0 0; }
    .control-group, .controls, .input-prepend, .input-append, .userdata{ background: none !important; }
    .btn-primary { margin: 20px 0 0 0 !important;}
    .hasTooltip { display: inline-block !important;} 



    • Partager sur Facebook
    • Partager sur Twitter
      6 août 2018 à 16:00:14

      Salut,

      clic dans ma signature pour avoir une base.
      Ensuite au clic ça sera du js.

      -
      Edité par Frogweb 6 août 2018 à 16:00:26

      • Partager sur Facebook
      • Partager sur Twitter
      Vous cherchez à faire un menu déroulant ? Visitez www.frogweb.fr ! frogweb le site qu'il vous faut !

      Rendre un menu dynamique au clic de la souris

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown