From ec8e9af86c126b0ca106b63e816fadffa827d300 Mon Sep 17 00:00:00 2001 From: Kevin Ball Date: Mon, 9 Jan 2017 10:22:09 -0800 Subject: [PATCH] Fix responsive toggle to pay attention to targets of internal toggles --- js/foundation.responsiveToggle.js | 5 +- .../responsive-toggle/responsive-toggle.html | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 test/visual/responsive-toggle/responsive-toggle.html 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

+ + + + + -- 2.47.3