From: Kevin Ball Date: Mon, 9 Jan 2017 18:22:09 +0000 (-0800) Subject: Fix responsive toggle to pay attention to targets of internal toggles X-Git-Tag: 6.3.1~11^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9622%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Fix responsive toggle to pay attention to targets of internal toggles --- diff --git a/js/foundation.responsiveToggle.js b/js/foundation.responsiveToggle.js index cf1677566..134e6a3f2 100644 --- a/js/foundation.responsiveToggle.js +++ b/js/foundation.responsiveToggle.js @@ -38,7 +38,10 @@ class ResponsiveToggle { } this.$targetMenu = $(`#${targetID}`); - this.$toggler = this.$element.find('[data-toggle]'); + this.$toggler = this.$element.find('[data-toggle]').filter(function() { + var target = $(this).data('toggle'); + return (target === targetID || target === ""); + }); this.options = $.extend({}, this.options, this.$targetMenu.data()); // If they were set, parse the animation classes diff --git a/test/visual/responsive-toggle/responsive-toggle.html b/test/visual/responsive-toggle/responsive-toggle.html new file mode 100644 index 000000000..1ec17a9cf --- /dev/null +++ b/test/visual/responsive-toggle/responsive-toggle.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + +
+ +
Menu
+ + + + +
+ +
+
+ +
+
+ +
+
+

Dropdown button should only show dropdown, menu buttons should only show menu

+ + + + +