From: Alec Joy Date: Fri, 4 Nov 2016 20:06:18 +0000 (-0400) Subject: Add an option to the drilldown menu to position the back button at the top or bottom... X-Git-Tag: v6.3-rc1~6^2~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9358%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add an option to the drilldown menu to position the back button at the top or bottom of a drilldown list --- diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index feebac5c7..50fb0f6cb 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -85,7 +85,16 @@ class Drilldown { var $menu = $(this), $back = $menu.find('.js-drilldown-back'); if(!$back.length){ - $menu.prepend(_this.options.backButton); + switch (_this.options.backButtonPosition) { + case "bottom": + $menu.append(_this.options.backButton); + break; + case "top": + $menu.prepend(_this.options.backButton); + break; + default: + console.error("Unsupported backButtonPosition value '" + _this.options.backButtonPosition + "'"); + } } _this._back($menu); }); @@ -389,11 +398,17 @@ class Drilldown { Drilldown.defaults = { /** - * Markup used for JS generated back button. Prepended to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting. + * Markup used for JS generated back button. Prepended or appended (see backButtonPosition) to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting. * @option * @example '<\li><\a>Back<\/a><\/li>' */ backButton: '
  • Back
  • ', + /** + * Position the back button either at the top or bottom of drilldown submenus. + * @option + * @example bottom + */ + backButtonPosition: 'top', /** * Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting. * @option