From a13b91d36ac72f0045a03402dc7040a226102ff5 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 1 Mar 2011 19:48:05 +0000 Subject: Fixes #3032: toggler pattern is now ... Wow, so much nicer. git-svn-id: http://code.elgg.org/elgg/trunk@8538 36083f99-b078-4883-b0ff-0f9b5a30f544 --- js/lib/ui.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'js/lib/ui.js') diff --git a/js/lib/ui.js b/js/lib/ui.js index df3c102ce..3118bb408 100644 --- a/js/lib/ui.js +++ b/js/lib/ui.js @@ -25,8 +25,7 @@ elgg.ui.init = function () { * Toggles an element based on clicking a separate element * * Use .elgg-toggler on the toggler element - * Add another class to the toggler called elgg-toggles- - * The id of the element being toggled is + * Set the href to target the item you want to toggle () * * @param {Object} event * @return void @@ -34,11 +33,9 @@ elgg.ui.init = function () { elgg.ui.toggles = function(event) { event.preventDefault(); - $(this).toggleClass('elgg-state-active'); + var target = $(this).toggleClass('elgg-state-active').attr('href'); - var togglees = $(this).attr('class').match(/elgg-toggles-[^ ]*/i); - - $('#' + togglees[0].replace('elgg-toggles-', '')).slideToggle('medium'); + $(target).slideToggle('medium'); } /** -- cgit v1.2.3