I have an ajax enabled pager in a view. After I page in the view, the menu no longer works.

I have traced it to the click event on the menu not working. Toggling the element referred to in the click function in the console works to get the menu flying out and back.

This can be reproduced in a desktop browser.

Comments

willowdigit’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Active » Closed (cannot reproduce)

I have just tried to reproduce the error on a clean install of Drupal 7.27. with bamboo installed, and I cannot. The problem is obviously somewhere else.

danny englander’s picture

I'd be curious to know if you checked Chrome console for js errors on the instance where you were getting the error. I'm thinking we'd need to wrap the menu call with a jQuery.once function to protect it from ajax messing with it. That usually solves a bag of hurt. At any rate, I won't have a chance to test this for another week or so, I'm pretty heads down with work atm.

willowdigit’s picture

Please disregard #1. I am able to reproduce the error on a clean install of Drupal with views using a variety of browsers.

What I have also noticed now is that the menu does not work when I page away from page 1, but when I page back to page 1 it works again.

It seems that on initial load of page 1, the menu click event fires once for every mouse click. When I go to page two, the click event fires twice (opening and closing the menu in one go). Then, back on page one, the menu opens again as the click event fires 3 times (open, close, open), and with each pager navigation 1 click is added to the process.

willowdigit’s picture

After a bit of Googling I found the solution is to use the once() function as highrockmedia in #2 rightly suggests.

willowdigit’s picture

Status: Closed (cannot reproduce) » Needs review
danny englander’s picture

Assigned: Unassigned » danny englander
Status: Needs review » Fixed

Thanks for the patch, tested and fixes the issue. Pushed to dev at http://drupalcode.org/project/bamboo.git/commit/cbf516f I've attributed your authorship to the commit.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.