From: Brett Mason Date: Tue, 16 Feb 2016 19:10:24 +0000 (+0000) Subject: Add drilldown parent link option. If set to true this prepend's the parent link to... X-Git-Tag: v6.2.0~52^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8178%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add drilldown parent link option. If set to true this prepend's the parent link to the submenu. --- diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index 88be96084..55ad35c4b 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -68,6 +68,9 @@ class Drilldown { this.$submenuAnchors.each(function(){ var $sub = $(this); var $link = $sub.find('a:first'); + if(_this.options.parentLink){ + $link.clone().prependTo($sub.children('[data-submenu]')).wrap('
  • '); + } $link.data('savedHref', $link.attr('href')).removeAttr('href'); $sub.children('[data-submenu]') .attr({ @@ -295,7 +298,7 @@ class Drilldown { this._hideAll(); Foundation.Nest.Burn(this.$element, 'drilldown'); this.$element.unwrap() - .find('.js-drilldown-back').remove() + .find('.js-drilldown-back, .is-submenu-parent-item').remove() .end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu') .end().find('[data-submenu]').removeAttr('aria-hidden tabindex role') .off('.zf.drilldown').end().off('zf.drilldown'); @@ -322,6 +325,12 @@ Drilldown.defaults = { * @example '<\div class="is-drilldown"><\/div>' */ wrapper: '
    ', + /** + * Adds the parent link to the submenu. + * @option + * @example false + */ + parentLink: false, /** * Allow the menu to return to root list on body click. * @option