I feel like I'm missing something here. What I'd like to do is run some javascript/jquery code when a menu is expanded or collapsed. How would I add this? From reading, it seems like I would attach a behavior to the event/action, but I don't know how to do that.

Any ideas?

FYI. The case I'm presently working on is to use jquery gradients on blocks that change length when a menu is expanded. I'm using the jacg plugin (https://launchpad.net/jacg). It works great in FF but other browsers are hit and miss. I can see other use cases for executing javascript on expand/collapse as well. Thanks.

Comments

diodata’s picture

It my case, it'd be nice to run a script once the expansion/collapse is complete. There are other cases where they could occur simultaneously as well.

As a temp workaround to the gradient background problem, I added the following line in dhtml_menu.js inside the Drupal.dhtmlMenu.toggleMenu function:

setTimeout("$('.column-1 .block').jacg({'radius': '0em', 'start': '#ffffff','end': '#dbdee3'}).css({'-webkit-box-shadow': 'rgba(10, 10, 10, 0.4) 1px 1px 10px', '-mox-box-shadow': '1px 1px 10px rgba(10, 10, 10, 0.4)' })",500);

This is NOT a great solution! The setTimeout is necessary so it runs (sets the gradient background) after 50 0ms, which is enough time for the expansion/collapse to complete most of the time. Of course, I would prefer to NOT hack the module js file and make this run at the end of DHTML expansion/collapse.

vuil’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I close as Closed (outdated). It uses outdated Drupal 6 and module 6.x branch.