From: Arian Xhezairi Date: Fri, 25 Nov 2016 02:00:04 +0000 (+0100) Subject: Tabs: account updateHistory only if deepLink:true. X-Git-Tag: v6.3-rc1~11^2~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7c7a767b261fd3742f8e1926fc054b0267d4b35;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Tabs: account updateHistory only if deepLink:true. --- diff --git a/docs/pages/tabs.md b/docs/pages/tabs.md index 9f2c1c56e..a9fa7972a 100644 --- a/docs/pages/tabs.md +++ b/docs/pages/tabs.md @@ -156,13 +156,13 @@ Add the attribute `data-deep-link="true" to a tabstrip to allow anchoring to and ```html_example -
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

diff --git a/js/foundation.tabs.js b/js/foundation.tabs.js index 39ca0f7cc..a6a607bc6 100644 --- a/js/foundation.tabs.js +++ b/js/foundation.tabs.js @@ -237,11 +237,16 @@ class Tabs { this._openTab($target); //either replace or update browser history - var anchor = $target.find('a').attr('href'); - if (this.options.updateHistory) { - history.pushState({}, "", anchor); + if (this.options.deepLink) { + var anchor = $target.find('a').attr('href'); + + if (this.options.updateHistory) { + history.pushState({}, '', anchor); + } else { + history.replaceState({}, '', anchor); + } } else { - history.replaceState({}, "", anchor); + location.hash = ''; } /**