I use Ajax for infinite scroll in views. When I go to a views page with this option the collapsible menu works fine. However, after I click "Show more" (infinite scroll), the menu stops working properly. Now, when I click on the menu it opens, closes, then opens and stays open. The reverse when I click it again to close it: closes, opens, then finally closes. Right now I have all Ajax in views disabled until this is fixed.

I'v tried DEV and it does the same thing. When I update DEV with this patch I can no longer open the menu at all. By the way, it's the same with the stable release, which already has the patch. So, now I'm using the stable release with this code removed.

diff --git a/js/collapsible-menu.js b/js/collapsible-menu.js
index 50e0428..85cd632 100644
--- a/js/collapsible-menu.js
+++ b/js/collapsible-menu.js
@@ -19,8 +19,13 @@
         return;
       }
 
-      // Append toggle link to the main menu.
-      $('nav#main-menu').append('<a href="#" id="menu-toggle">' + Drupal.t('Menu') + '</a>');
+      // Append toggle link to the main menu if not already exists.
+      if ($('a#menu-toggle').length == 0) {
+      	$('nav#main-menu').append('<a href="#" id="menu-toggle">' + Drupal.t('Menu') + '</a>');
+      }
+      else {
+      	return;
+      }
 
       // Collapse/expand menu by click on link.
       $('a#menu-toggle').click(function() {

Comments

System Lord created an issue. See original summary.

System Lord’s picture

Title: Collapsible menu opens, closes, opens when Views Ajax is used. » Collapsible menu opens, closes, opens when ANY JQUERY is used.
Priority: Normal » Minor
Status: Active » Closed (outdated)
System Lord’s picture

Status: Active » Closed (outdated)