fuji Posted March 13, 2009 Share Posted March 13, 2009 Bonjour alors voila j ai un menu deroulant en css a 3 niveau cat/souscat/souscat2 pour l arbre de sous categorie : /* Block categories */ div#categories_block_left ul.tree { padding-left:0.5em; } div#categories_block_left ul.dhtml{ display:none; } div#categories_block_left ul.tree li { border:none; padding-left:15px; background: none; margin-left:0; font-weight:bold; font-size:13px; line-height:13px; margin-top:2px; } div#categories_block_left ul.tree li ul li{ padding-left:15px; background:none; font-size:11px; font-weight:normal; } div#categories_block_left ul.tree li ul li ul li{ padding-left:15px; font-size:9px; } div#categories_block_left ul.tree a{ padding-left:0; color:#374853; } div#categories_block_left ul.tree a:hover{ text-decoration:none; } div#categories_block_left ul.tree a.selected{ color: #488c40; font-weight: bold; } div#categories_block_left span.grower{ display:block; float:left; background-position: 0px 3px; background-repeat: no-repeat; width:9px; height:15px; margin: 0 0 0 -10px!important; margin: 0 0 0 -6px; padding: 0; } div#categories_block_left span.OPEN { background-image: url('../img/icon/less.gif'); } div#categories_block_left span.CLOSE{ background-image: url('../img/icon/more.gif'); } Le probleme je voudrais que par defaut la premiere categorie affiche la 1ere sous categorie mais par contre qu elle n affiche pas la 2eme sous categorieJ ai fait une image de ce que je voudrais obtenir voila merci d avance Link to comment Share on other sites More sharing options...
Peha Posted March 13, 2009 Share Posted March 13, 2009 Bonjour,ce genre de chose se passe plutôt dans le fichier javascript qui gère le menu.En effet, si tu masques une sous catégorie dans ton css et que tu gère sa réapparition en javascript, ton menu serait inutilisable pas ceux qui n'ont pas javascript activé sur leurs navigateurs.Il faut donc trouver le fichier javascript (jQuery) et lui dire de masquer tes sous-sous-catégories avant l'affichage de la page.Puis de lui commander lorsqu'on clique sur les sous catégories de dérouler la sous-sous-catégorie correspondante.pa. Link to comment Share on other sites More sharing options...
Peha Posted March 13, 2009 Share Posted March 13, 2009 pour masquer tes sous-sous-sous menu en jquery, ça doit donner un truc du style $(#categories_block_left ul ul ul).hide(); où #categories_block_left ul correspond à la liste des catégories,le ul suivant les sous catégories,et le dernier ul, celui qui nous intéresse, celui que l'on va cacher. Link to comment Share on other sites More sharing options...
fuji Posted March 13, 2009 Author Share Posted March 13, 2009 //animate the opening of the branch (span.grower jQueryElement) function openBranch(jQueryElement, noAnimation) { jQueryElement.addClass('OPEN').removeClass('CLOSE'); if(noAnimation) jQueryElement.parent().find('ul:first').show(); else jQueryElement.parent().find('ul:first').slideDown(); } //animate the closing of the branch (span.grower jQueryElement) function closeBranch(jQueryElement, noAnimation) { jQueryElement.addClass('CLOSE').removeClass('OPEN'); if(noAnimation) jQueryElement.parent().find('ul:first').hide(); else jQueryElement.parent().find('ul:first').slideUp(); } //animate the closing or opening of the branch (ul jQueryElement) function toggleBranch(jQueryElement, noAnimation) { if(jQueryElement.hasClass('OPEN')) closeBranch(jQueryElement, noAnimation); else openBranch(jQueryElement, noAnimation); } //when the page is loaded... $(document).ready(function () { //to do not execute this script as much as it's called... if(!$('ul.tree.dhtml').hasClass('dynamized')) { //add growers to each ul.tree elements $('ul.tree.dhtml ul').prev().before(" "); //dynamically add the '.last' class on each last item of a branch $('ul.tree.dhtml ul li:last-child, ul.tree.dhtml li:last-child').addClass('last'); //collapse every expanded branch $('ul.tree.dhtml span.grower.OPEN').addClass('CLOSE').removeClass('OPEN').parent().find('ul:first').hide(); $('ul.tree.dhtml').show(); //open the tree for the selected branch $('ul.tree.dhtml .selected').parents().each( function() { if ($(this).is('ul')) toggleBranch($(this).prev().prev(), true); }); toggleBranch( $('ul.tree.dhtml .selected').prev(), true); //add a fonction on clicks on growers $('ul.tree.dhtml span.grower').click(function(){ toggleBranch($(this)); }); //mark this 'ul.tree' elements as already 'dynamized' $('ul.tree.dhtml').addClass('dynamized'); $('ul.tree.dhtml').removeClass('dhtml'); } }); Merci pour ta reponse, voila mon fichier js, mais je comprends pas trop comment masquer ça Link to comment Share on other sites More sharing options...
Peha Posted March 13, 2009 Share Posted March 13, 2009 Bon, ils utilisent une methode un peu détournée, je ne sais pas trop pourquoi... on peut essayer de pas tout chambouler //add growers to each ul.tree elements $('ul.tree.dhtml ul ul').prev().before(" "); peux tu essayer juste ça ? Link to comment Share on other sites More sharing options...
fuji Posted March 16, 2009 Author Share Posted March 16, 2009 ça marche merci beaucoup Link to comment Share on other sites More sharing options...
Peha Posted March 16, 2009 Share Posted March 16, 2009 Cool !n'oublie pas de mettre RESOLU dans le titre de ton premier postpa. Link to comment Share on other sites More sharing options...
Jean-Bruno Posted May 28, 2009 Share Posted May 28, 2009 Bonjour je cherche à faire l'inversec'est a dire à masquer les sous catégories d'une seule de mes catégories, ce à un groupe donné. Est-ce possible ? et si oui comment ? Link to comment Share on other sites More sharing options...
Jean-Bruno Posted June 8, 2009 Share Posted June 8, 2009 Pas d'idée ? Déjà les vacances d'été ? siouplait … Link to comment Share on other sites More sharing options...
Patric Posted June 8, 2009 Share Posted June 8, 2009 Il y a peut-être une solution, mais ça implique d'affecter tout le monde sauf ceux qui peuvent pas voir les catégories à un groupe d'utilisateurs...Il faut donc créer un groupe d'utilisateurs "toto", associer les sous-catégories en question à ce groupe. Et affecter les membres qui peuvent les voir (c'est à dire tout le monde sauf ceux qui peuvent pas les voir) à ce groupe.Fastidieux.Et puis comment déterminer qu'une personne donnée qui s'inscrit ne doit pas pouvoir voir ces catégories ? Link to comment Share on other sites More sharing options...
Jean-Bruno Posted June 8, 2009 Share Posted June 8, 2009 Merci ZENDIKLe truc c'est que je ne veux pas que la catégorie apparaisse dans le menu à gauche pour ceux qui ne font pas parti du groupe. Ton idée ça ferait ça ? Link to comment Share on other sites More sharing options...
Patric Posted June 8, 2009 Share Posted June 8, 2009 Normalement si une personne ne fait pas partie d'un des groupes associés à une catégorie, il ne las voit pas dans le bloc.Faut essayer. Link to comment Share on other sites More sharing options...
Peha Posted June 16, 2009 Share Posted June 16, 2009 Bonjour djaOle mieux est d'ouvrir un nouveau topic car celui ci est résolu et n'attirera donc pas grand monde pour t'apporter une solution Link to comment Share on other sites More sharing options...
Patric Posted June 16, 2009 Share Posted June 16, 2009 Bonjour djaOle mieux est d'ouvrir un nouveau topic car celui ci est résolu et n'attirera donc pas grand monde pour t'apporter une solution J'ai déplacé son post dans un autre dont le sujet était en rapport. ;-) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now