diff --git a/src/Resources/themes/default/doctum.js.twig b/src/Resources/themes/default/doctum.js.twig index a46f8f9b..5d0d70e7 100644 --- a/src/Resources/themes/default/doctum.js.twig +++ b/src/Resources/themes/default/doctum.js.twig @@ -76,8 +76,10 @@ var Doctum = { {# Enable the version switcher #} var versionSwitcher = document.getElementById('version-switcher'); if (versionSwitcher !== null) { - versionSwitcher.addEventListener('change', function () { - window.location = this.value; + var currentVersion = versionSwitcher.options[versionSwitcher.selectedIndex].dataset.version; + versionSwitcher.addEventListener('change', function (event) { + var targetVersion = event.target.options[event.target.selectedIndex].dataset.version; + window.location = window.location.pathname.replace(currentVersion, targetVersion); }); } {% endif %}