diff options
-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 * |