-
-
Save thelebster/563dc99f4bcf15f979f4b6802f3d1bff to your computer and use it in GitHub Desktop.
Use custom jQuery toggle functionality in Drupal 7 to prevent multiple triggered elements, because of updated DOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function ($) { | |
| Drupal.behaviors.accordion = { | |
| attach: function (context, settings) { | |
| $('.accordion h3.title').once('accordion', function () { | |
| $('.accordion h3.title').toggle(function () { | |
| // Actions here | |
| }, function () { | |
| // Actions here | |
| }); | |
| }); | |
| } | |
| }; | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment