js:choca_menu

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
js:choca_menu [2024/10/29 11:38] avillepreuxjs:choca_menu [2024/10/30 12:01] (Version actuelle) avillepreux
Ligne 75: Ligne 75:
     cursor: pointer;     cursor: pointer;
 } }
-.wrap_nav.wrap_choca > * > *.collapsed:before {+.wrap_nav.wrap_choca > * > * 
 + transition: all .1s; 
 +
 +.wrap_nav.wrap_choca > * > *:not([open]):before {
     content: "▼";     content: "▼";
 } }
-.wrap_nav.wrap_choca > * > *.collapsed {+.wrap_nav.wrap_choca > * > *:not([open]) {
     height: 2.0em;     height: 2.0em;
     overflow: hidden;     overflow: hidden;
Ligne 84: Ligne 87:
  
 .wrap_nav.wrap_choca > .wrap_column > p, .wrap_nav.wrap_choca > .wrap_column > p,
-.wrap_nav.wrap_choca > *             > p.collapsed+.wrap_nav.wrap_choca > *            > p:not([open])
 { {
     display: none;     display: none;
Ligne 98: Ligne 101:
 } }
  
-.dokuwiki .wrap_choca .submenu-hidden {+.dokuwiki .wrap_choca ul ul { 
 +    height: auto; 
 +    overflow: hidden
 +    transition: all .1s; 
 +
 +.dokuwiki .wrap_choca ul ul:not([open]) {
     height: 0;     height: 0;
-    line-height: 0;+  /*line-height: 0;*/
   /*margin-top: -10px;*/   /*margin-top: -10px;*/
 } }
-.dokuwiki .wrap_choca .submenu-hidden * { +.dokuwiki .wrap_choca ul ul:not([open]) * { 
-    max-height: 0; +  /*max-height: 0;*/ 
-    line-height: 0;+  /*line-height: 0;*/
 } }
  
Ligne 518: Ligne 526:
                  
         var menu_id = 0;         var menu_id = 0;
-         +                
-        document.querySelectorAll(".wrap_nav.wrap_choca .wrap_block a").forEach(function(link) { +
-         +
-        /*console.log("DEBUG", link, "Register stop propagation event");*/ +
-         +
-        link.addEventListener("click", function(event) { +
-         +
-        console.log("DEBUG", link, event, "Stopped propagation"); +
-        event.stopPropagation(); +
-        return false;         +
-        });         +
-        }); +
-        +
         jQuery(".wrap_nav.wrap_choca > * > *").each(function() {         jQuery(".wrap_nav.wrap_choca > * > *").each(function() {
                  
             ++menu_id;             ++menu_id;
                          
-          /*jQuery(this).find("p").first().find("a").first().click(function(event) { */ 
-            jQuery(this).find("p > span > a").first().click(function(event) { 
-             
-                /*console.log("DEBUG", event, "Stopped propagation");*/ 
-                event.stopPropagation(); 
-                return false; 
-            }); 
- 
             if (use_cookies_menu) {             if (use_cookies_menu) {
  
Ligne 550: Ligne 538:
                 var hidden = at(menu_click_coockie, menu_id);                 var hidden = at(menu_click_coockie, menu_id);
                          
-                if (hidden) { +                if (!hidden) { 
-                    jQuery(this).addClass("collapsed");+                    jQuery(this).attr('open', true);
                 }                 }
             }             }
  
-            jQuery(this).find("p").first().click(function() {+            jQuery(this).find("p").first().on("click", function(event) {
                          
-                console.log("DEBUG", "Top level block header click", this, jQuery(this).parent());+                if (event.target.tagName == "A"return;
  
-                jQuery(this).parent().toggleClass("collapsed");+ if (!!jQuery(this).parent().attr("open")) 
 +                jQuery(this).parent().removeAttr("open"); 
 +              else 
 +              jQuery(this).parent().attr("open", true);
                                  
                 if (use_cookies_menu) {                 if (use_cookies_menu) {
  
-                    var hidden = jQuery(this).parent().hasClass("collapsed");+                    var hidden = !jQuery(this).parent().attr("open");
  
                     var id = jQuery(this).parent().attr("data-id");                     var id = jQuery(this).parent().attr("data-id");
Ligne 584: Ligne 575:
                  
         jQuery(".toggle_choca").click(function () {         jQuery(".toggle_choca").click(function () {
-            jQuery(this).toggleClass("collapsed"); +             
-            jQuery(".wrap_nav.wrap_choca > * > * > p").click();+ if (!!jQuery(this).attr("open")) 
 +                jQuery(this).removeAttr("open"); 
 +              else 
 +              jQuery(this).attr("open", true); 
 +             
 +            jQuery(".wrap_nav.wrap_choca > * > * > p").click();
         });         });
                  
Ligne 612: Ligne 608:
                 var hidden = !at(submenu_click_coockie, submenu_id);                 var hidden = !at(submenu_click_coockie, submenu_id);
                          
-                if (hidden) { +                if (!hidden) { 
-                    l2_submenu.addClass("submenu-hidden");+                    l2_submenu.attr("open", true);
                 }                 }
  
Ligne 619: Ligne 615:
  
                     var id = jQuery(e.target).attr("data-id");                     var id = jQuery(e.target).attr("data-id");
-                    jQuery('ul[data-id="'+id+'"]').toggleClass("submenu-hidden");+                  /*jQuery('ul[data-id="'+id+'"]').toggleClass("submenu-hidden");*/ 
 +                    if (!!jQuery('ul[data-id="'+id+'"]').attr("open")) 
 +                    jQuery('ul[data-id="'+id+'"]').removeAttr("open"); 
 +                    else 
 +                    jQuery('ul[data-id="'+id+'"]').attr("open", true);
  
-                    var hidden = jQuery('ul[data-id="'+id+'"]').hasClass("submenu-hidden");+                  /*var hidden = jQuery('ul[data-id="'+id+'"]').hasClass("submenu-hidden");*/ 
 +                    var hidden = !jQuery('ul[data-id="'+id+'"]').attr("open");
    
                     var submenu_click_coockie = cookie_get('CYA_CHOCA_MENU_SUBMENU_CLICK');                     var submenu_click_coockie = cookie_get('CYA_CHOCA_MENU_SUBMENU_CLICK');
  • js/choca_menu.1730198315.txt.gz
  • Dernière modification : 2024/10/29 11:38
  • de avillepreux