Skip to content

Commit

Permalink
fix #1391
Browse files Browse the repository at this point in the history
  • Loading branch information
inc2734 committed Oct 2, 2023
1 parent 21708c5 commit c7dd46c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/css/app/layout/_contents/_app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
&__sidebar {
@include _set-content-level(1);
}

&[data-with-sidebar="false"] {
overflow: hidden;
}
}

/**
Expand Down
24 changes: 23 additions & 1 deletion src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,32 @@ document.addEventListener( 'DOMContentLoaded', () => {
} );
} );

const resizeObserver = new ResizeObserver( ( entries ) => {
const resizeObserver = new ResizeObserver( () => {
setTimeout( () => setItemsVars( items ), 100 );
} );
resizeObserver.observe( header );
}
}
} );

document.addEventListener( 'DOMContentLoaded', () => {
const contents = document.querySelector( '.l-contents' );
if ( ! contents ) {
return;
}

const main = contents.querySelector( '.l-contents__main' );
const sidebar = contents.querySelector( '.l-contents__sidebar' );
if ( ! main || ! sidebar ) {
contents.setAttribute( 'data-with-sidebar', false );
return;
}

const resizeObserver = new ResizeObserver( () => {
const maybeWithSidebar = main.offsetWidth !== sidebar.offsetWidth || main.getBoundingClientRect().top === sidebar.getBoundingClientRect().top;

contents.setAttribute( 'data-with-sidebar', maybeWithSidebar );
console.log( maybeWithSidebar );
} );
resizeObserver.observe( contents );
} );

0 comments on commit c7dd46c

Please sign in to comment.