aboutsummaryrefslogtreecommitdiff
path: root/js/lib/ui.js
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-12 20:40:31 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-12 20:40:31 +0000
commitda63469210a1c6492b5a0b832b1a54109f248a86 (patch)
tree6486f7d068c927e1c301020300217cdc8a915f48 /js/lib/ui.js
parent3ceb54a59cc3cdeafec7c74d14a371acf09c216a (diff)
downloadelgg-da63469210a1c6492b5a0b832b1a54109f248a86.tar.gz
elgg-da63469210a1c6492b5a0b832b1a54109f248a86.tar.bz2
added toggler function
git-svn-id: http://code.elgg.org/elgg/trunk@7607 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/lib/ui.js')
-rw-r--r--js/lib/ui.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index a9315883f..1ebc3bca6 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -5,6 +5,8 @@ elgg.ui.init = function () {
$('.elgg-system-messages li').live('click', function() {
$(this).stop().fadeOut('fast');
});
+
+ $('.elgg-toggle').click(elgg.ui.toggle);
$('a.collapsibleboxlink').click(elgg.ui.toggleCollapsibleBox);
@@ -21,6 +23,22 @@ elgg.ui.init = function () {
});
};
+/**
+ * Toggles an element based on clicking a separate element
+ *
+ * Use .elgg-toggle on the toggler element
+ * The id of the toggler is elgg-toggler-<id>
+ * The id of the element being toggled is elgg-togglee-<id>
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.ui.toggle = function(event) {
+ var id = $(this).attr('id').replace('toggler', 'togglee');
+ $('#' + id).slideToggle('medium');
+ event.preventDefault();
+}
+
// reusable generic hidden panel
elgg.ui.toggleCollapsibleBox = function () {
$(this.parentNode.parentNode).children(".collapsible_box").slideToggle("fast");