diff --git a/templates/fields/_locale.twig b/templates/fields/_locale.twig index 678dd56..839ce1c 100644 --- a/templates/fields/_locale.twig +++ b/templates/fields/_locale.twig @@ -77,6 +77,24 @@ ); {% endif %} }); + + var localeTab = document.querySelector('#locale-select'); + + if (localeTab !== null) { + var links = localeTab.querySelectorAll('a'); + + window.onhashchange = function (){ + var tab = window.location.hash.substr(1); + + Array.prototype.forEach.call(links, function(link) { + var origHref = link.getAttribute('href').split('#')[0]; + + if (tab.length>0) { + link.setAttribute('href', origHref + '#' + tab); + } + }); + }; + }