Elgg  Version 3.0
Functions
item_toggle.js File Reference

Go to the source code of this file.

Functions

 define (['elgg', 'jquery'], function(elgg,$){$(document).on('click', '.elgg-menu a[data-toggle]', function(event){var $item_clicked=$(this).closest('li');var $menu=$item_clicked.closest('.elgg-menu');var other_menuitem_name=$(this).data().toggle.replace('_', '-');var $other_item=$menu.find('.elgg-menu-item-'+other_menuitem_name).eq(0);if(!$other_item){return;}var $both_items=$item_clicked.add($other_item);$both_items.toggleClass('hidden');$other_item.focus();elgg.action($(this).attr('href'),{success:function(json){if(json.system_messages.error.length){$both_items.toggleClass('hidden');$item_clicked.focus();}else{elgg.trigger_hook('toggle', 'menu_item',{itemClicked:$item_clicked, itemToggled:$other_item, menu:$menu, data:json});}}, error:function(){$both_items.toggleClass('hidden');$item_clicked.focus();}});return false;});})
 Adds menu item toggle features. More...
 

Function Documentation

define ( function(elgg,$){$(document).on('click', '.elgg-menu a[data-toggle]', function(event){var $item_clicked=$(this).closest('li');var $menu=$item_clicked.closest('.elgg-menu');var other_menuitem_name=$(this).data().toggle.replace('_', '-');var $other_item=$menu.find('.elgg-menu-item-'+other_menuitem_name).eq(0);if(!$other_item){return;}var $both_items=$item_clicked.add($other_item);$both_items.toggleClass('hidden');$other_item.focus();elgg.action($(this).attr('href'),{success:function(json){if(json.system_messages.error.length){$both_items.toggleClass('hidden');$item_clicked.focus();}else{elgg.trigger_hook('toggle', 'menu_item',{itemClicked:$item_clicked, itemToggled:$other_item, menu:$menu, data:json});}}, error:function(){$both_items.toggleClass('hidden');$item_clicked.focus();}});return false;});}  )

Adds menu item toggle features.