diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-14 19:11:16 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-14 19:11:16 +0000 |
commit | 3d33373462361573a45e1feb7b8a120c307c5aae (patch) | |
tree | 7209d3866a5545b03526b03b89b54a0a3f987fd3 /js | |
parent | ac0296c30d6c00f2d0d744217b0c46ec0e88c850 (diff) | |
download | elgg-3d33373462361573a45e1feb7b8a120c307c5aae.tar.gz elgg-3d33373462361573a45e1feb7b8a120c307c5aae.tar.bz2 |
Fixes #2902: Added elgg-toggler pattern.
git-svn-id: http://code.elgg.org/elgg/trunk@8228 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js')
-rw-r--r-- | js/lib/ui.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js index 6fc3dd3bf..7b67c5586 100644 --- a/js/lib/ui.js +++ b/js/lib/ui.js @@ -13,13 +13,12 @@ elgg.ui.init = function () { $('.elgg-system-messages li').fadeOut('slow'); $('.elgg-toggle').live('click', elgg.ui.toggle); - + $('.elgg-toggler').live('click', elgg.ui.toggles); + $('.elgg-menu-page .elgg-menu-parent').live('click', elgg.ui.toggleMenu); $('.elgg-like-toggle').live('click', elgg.ui.toggleLikes); - - $('a.collapsibleboxlink').click(elgg.ui.toggleCollapsibleBox); -}; +} /** * Toggles an element based on clicking a separate element @@ -32,9 +31,21 @@ elgg.ui.init = function () { * @return void */ elgg.ui.toggle = function(event) { - var id = $(this).attr('id').replace('toggler', 'togglee'); + event.preventDefault(); + + var id = $(this).toggleClass('elgg-state-active').attr('id').replace('toggler', 'togglee'); + $('#' + id).slideToggle('medium'); +} + +elgg.ui.toggles = function(event) { event.preventDefault(); + + $(this).toggleClass('elgg-state-active'); + + var togglees = $(this).attr('class').match(/elgg-toggles-[^ ]*/i); + + $('#' + togglees[0].replace('elgg-toggles-', '')).slideToggle('medium'); } /** @@ -49,12 +60,6 @@ elgg.ui.toggleMenu = function(event) { event.preventDefault(); } -// reusable generic hidden panel -elgg.ui.toggleCollapsibleBox = function () { - //$(this.parentNode.parentNode).children(".collapsible_box").slideToggle("fast"); - return false; -}; - /** * Toggles the likes list * |