Skip to content

Commit

Permalink
fix tabs bug (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
recrwplay authored Mar 8, 2024
1 parent 75bdd8c commit 4ec7c3a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/js/08-tabs-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,13 @@ document.addEventListener('DOMContentLoaded', function () {
return hash && (~hash.indexOf('%') ? decodeURIComponent(hash) : hash).slice(1)
}

var fragment, target, scrollTo
if ((fragment = decodeFragment(window.location.hash)) && (target = document.getElementById(fragment))) {
const langSelection = target.getAttribute('data-lang')
const tabbed = target.closest('.tabbed')
scrollTo = tabbed.querySelector(`[data-lang=${langSelection}]`)
if (scrollTo) {
switchTab({
target: scrollTo,
})
}
var fragment, target, langSelection, scrollTo
if ((fragment = decodeFragment(window.location.hash)) &&
(target = document.getElementById(fragment)) &&
(langSelection = target.getAttribute('data-lang')) &&
(scrollTo = target.closest('.tabbed').querySelector(`[data-lang=${langSelection}]`))) {
switchTab({
target: scrollTo,
})
}
})

0 comments on commit 4ec7c3a

Please sign in to comment.