Created
January 22, 2012 20:51
-
-
Save input/1658737 to your computer and use it in GitHub Desktop.
Drupal 6 jQuery Demo
This file contains 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
<a href="#" id="togg-link">Click this link to toggle the content displayed below</a> | |
<div id="togg">Content to be toggled.</div> |
This file contains 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
Drupal.behaviors.togg = function (context) { | |
$('a#togg-link:not(.togg-processed)', context).addClass('togg-processed').each(function () { | |
$(this).click(function() { | |
$("div#togg").toggle(400); | |
return false; | |
}); | |
}); | |
}; |
This file contains 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
Usage | |
----- | |
- Output the HTML somewhere (e.g. in a node body) | |
- Add the js to your theme's scripts.js file | |
See: http://lhmdesign.com/drupal-jquery-demo for a demo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment