Skip to content

Commit

Permalink
mix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 10, 2024
1 parent 7964edf commit 49fc9b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion assets/js/search-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ window.addEventListener('scroll', function () {
backgroundLayer.classList.add('sm-fixed')
}

if (currentScroll == 0) {
if (currentScroll === 0) {
// Remove 'fixed' class when at the top
topSearch.classList.remove('sm-fixed')
sidebarMenu.classList.remove('sm-fixed')
Expand Down
14 changes: 7 additions & 7 deletions assets/js/sidebar/sidebar-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ export function initialize () {
addEventListeners()
}

function observeResizing() {
function observeResizing () {
const sidebarWidth = sessionStorage.getItem('sidebar_width')

if(sidebarWidth) {
if (sidebarWidth) {
setSidebarWidth(sidebarWidth)
}

const resizeObserver = new ResizeObserver((entries) => {
for (const entry of entries) {
setSidebarWidth(entry.contentRect.width);
setSidebarWidth(entry.contentRect.width)
}
});
})

resizeObserver.observe(document.getElementById('sidebar'));
resizeObserver.observe(document.getElementById('sidebar'))
}

function setSidebarWidth(width) {
function setSidebarWidth (width) {
sessionStorage.setItem('sidebar_width', width)
document.body.style.setProperty('--sidebarWidth', `${width}px`);
document.body.style.setProperty('--sidebarWidth', `${width}px`)
}

function setDefaultSidebarState () {
Expand Down

Large diffs are not rendered by default.

0 comments on commit 49fc9b1

Please sign in to comment.