diff --git a/src/js/06-code.js b/src/js/06-code.js index 9e4e0557..7f862fac 100644 --- a/src/js/06-code.js +++ b/src/js/06-code.js @@ -283,23 +283,6 @@ document.addEventListener('DOMContentLoaded', function () { el.classList.add(tabActive) }) }) - - var toolbarOffset = 0 - var toolbar = document.querySelector('.toolbar') - if (toolbar.offsetHeight) { - toolbarOffset = toolbar.offsetHeight - } - var offset = document.querySelector('.navbar').offsetHeight + toolbarOffset + 20 - - var bodyRect = document.body.getBoundingClientRect().top - var elementRect = tab.getBoundingClientRect().top - var elementPosition = elementRect - bodyRect - var offsetPosition = elementPosition - offset - - window.scrollTo({ - top: offsetPosition, - behavior: 'smooth', - }) } // Tabbed code diff --git a/src/js/08-tabs-block.js b/src/js/08-tabs-block.js index 1e87ddae..4d16b7fd 100644 --- a/src/js/08-tabs-block.js +++ b/src/js/08-tabs-block.js @@ -63,23 +63,6 @@ document.addEventListener('DOMContentLoaded', function () { }) }) - var toolbarOffset = 0 - var toolbar = document.querySelector('.toolbar') - if (toolbar.offsetHeight) { - toolbarOffset = toolbar.offsetHeight - } - var offset = document.querySelector('.navbar').offsetHeight + toolbarOffset + 20 - - var bodyRect = document.body.getBoundingClientRect().top - var elementRect = tab.getBoundingClientRect().top - var elementPosition = elementRect - bodyRect - var offsetPosition = elementPosition - offset - - window.scrollTo({ - top: offsetPosition, - behavior: 'smooth', - }) - if (sessionStorageAvailable) { window.sessionStorage.setItem('code_example_language', lang) }