Elgg  Version 3.0
Functions
toggle.js File Reference

Go to the source code of this file.

Functions

 define (function(require){var elgg=require('elgg');var toggle={init:function(){$(document).on('click', '.elgg-menu-item-has-toggle > a', function(e){e.preventDefault();var $trigger=$(this);var $target=$trigger.siblings('.elgg-child-menu').eq(0);var duration=$target.data('toggleDuration')|| 'fast';$target.slideToggle(duration, function(){if($target.is(':visible')){$target.css('display', 'flex');$trigger.addClass('elgg-menu-opened').removeClass('elgg-menu-closed');$trigger.parent().addClass('elgg-state-selected');}else{$trigger.addClass('elgg-menu-closed').removeClass('elgg-menu-opened');$trigger.parent().removeClass('elgg-state-selected');}});});$(document).on('click', '.elgg-menu-item-has-toggle > a >.elgg-anchor-label', function(e){var $anchor=$(this).closest('a');var href=$anchor.attr('href');if($anchor.hasClass('elgg-non-link')||!href){return;}document.location=href;e.preventDefault();e.stopImmediatePropagation();});toggle.init=elgg.nullFunction;}};toggle.init();return toggle;})
 Toggle menu module. More...
 

Function Documentation

define ( function(require){var elgg=require('elgg');var toggle={init:function(){$(document).on('click', '.elgg-menu-item-has-toggle > a', function(e){e.preventDefault();var $trigger=$(this);var $target=$trigger.siblings('.elgg-child-menu').eq(0);var duration=$target.data('toggleDuration')|| 'fast';$target.slideToggle(duration, function(){if($target.is(':visible')){$target.css('display', 'flex');$trigger.addClass('elgg-menu-opened').removeClass('elgg-menu-closed');$trigger.parent().addClass('elgg-state-selected');}else{$trigger.addClass('elgg-menu-closed').removeClass('elgg-menu-opened');$trigger.parent().removeClass('elgg-state-selected');}});});$(document).on('click', '.elgg-menu-item-has-toggle > a >.elgg-anchor-label', function(e){var $anchor=$(this).closest('a');var href=$anchor.attr('href');if($anchor.hasClass('elgg-non-link')||!href){return;}document.location=href;e.preventDefault();e.stopImmediatePropagation();});toggle.init=elgg.nullFunction;}};toggle.init();return toggle;}  )

Toggle menu module.

elgg/menus/toggle