Skip to content

Instantly share code, notes, and snippets.

@joshcoast
Created August 23, 2014 14:52
Show Gist options
  • Save joshcoast/6aaedb24fa25ac9efa5c to your computer and use it in GitHub Desktop.
Save joshcoast/6aaedb24fa25ac9efa5c to your computer and use it in GitHub Desktop.
So, what's the Drupal.behaviors doing?
Drupal.behaviors.addActiveClassToParentMenuIfSubnavPresent = {
attach: function (context, settings) {
$("#block-menu-block-1").each(function(){$("a[href='/products-equipment']").addClass("active").parent().addClass("active");});
}
};
@joshcoast
Copy link
Author

This might be a dumb question, but I've been seeing this quite a bit in new Drupal sites javascript, and I can't figure out what it is. In this code snippit, what's the "Drupal.behaviors" doing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment