diff options
| author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-12 20:40:31 +0000 | 
|---|---|---|
| committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-12 20:40:31 +0000 | 
| commit | da63469210a1c6492b5a0b832b1a54109f248a86 (patch) | |
| tree | 6486f7d068c927e1c301020300217cdc8a915f48 /js/lib | |
| parent | 3ceb54a59cc3cdeafec7c74d14a371acf09c216a (diff) | |
| download | elgg-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')
| -rw-r--r-- | js/lib/ui.js | 18 | 
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");
 | 
