diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-01 19:48:05 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-01 19:48:05 +0000 |
commit | a13b91d36ac72f0045a03402dc7040a226102ff5 (patch) | |
tree | 3ca3c2e4917926351a3f724d3eada836aa674f51 /js/lib | |
parent | 6b41bd72667ce810257a6ed35f090d3c702fb59e (diff) | |
download | elgg-a13b91d36ac72f0045a03402dc7040a226102ff5.tar.gz elgg-a13b91d36ac72f0045a03402dc7040a226102ff5.tar.bz2 |
Fixes #3032: toggler pattern is now <a href="#target" class="elgg-toggler">...</a> Wow, so much nicer.
git-svn-id: http://code.elgg.org/elgg/trunk@8538 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/ui.js | 9 |
1 files changed, 3 insertions, 6 deletions
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-<id> - * The id of the element being toggled is <id> + * Set the href to target the item you want to toggle (<a href="#id-of-target">) * * @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'); } /** |