From f0f85eb005d6bdba97fcab7ff25a21954c426ba1 Mon Sep 17 00:00:00 2001 From: Achim Hendriks Date: Tue, 25 Nov 2014 22:40:47 +0100 Subject: [PATCH] Use history API fallback to location hash this prevents the browser from jumping to the anchor identified by the hash --- lib/jquery.easytabs.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/jquery.easytabs.js b/lib/jquery.easytabs.js index d11c15e..aefec20 100644 --- a/lib/jquery.easytabs.js +++ b/lib/jquery.easytabs.js @@ -538,7 +538,12 @@ if ( settings.updateHash && ! skipUpdateToHash ) { //window.location = url.toString().replace((url.pathname + hash), (url.pathname + $clicked.attr("href"))); // Not sure why this behaves so differently, but it's more straight forward and seems to have less side-effects - window.location.hash = '#' + $targetPanel.attr('id'); + if (window.history.pushState) { + window.history.pushState(null, null, '#' + $targetPanel.attr('id')); + } + else { + window.location.hash = '#' + $targetPanel.attr('id'); + } } else { skipUpdateToHash = false; }