Skip to content
Snippets Groups Projects

Add scrollbar to menu if necessary

Merged Tögl, Christina requested to merge scrollable-menu into master
4 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Reiter, Christoph
  • A completely different approach would be to set

    max-height: calc(100vh - 43px);
    overflow-y: auto;

    on the menu. But I don't know if this handles all cases.

  • This only works in the sticky position. Otherwise the menu is too short.

  • added 1 commit

    • 7ffa0de5 - Replace hardcoded values and fix overflow calculation

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 408 409
    410 if (this.menuHeight === -1) {
    411 this.menuHeight = menu.clientHeight;
    412 }
    413
    414 let topValue = subtitle.getBoundingClientRect().bottom;
    415 let isMenuOverflow = this.menuHeight + topValue >= window.innerHeight ? true : false;
    416
    417 if (isMenuOverflow && !menu.classList.contains('hidden')) {
    418 menu.setAttribute('style', 'position: fixed;top: ' + topValue + 'px;bottom: 0;border-bottom: 0;overflow-y: auto;');
    419 menu.scrollTop = 0;
    420 document.body.setAttribute('style', 'overflow:hidden;');
    421
    422 } else if (isMenuOverflow && menu.classList.contains('hidden')) {
    423 document.body.removeAttribute('style', 'overflow:hidden;');
    424 menu.removeAttribute('style', 'position: fixed;top: ' + topValue + 'px;bottom: 0;border-bottom: 0;overflow-y: auto;');
  • added 1 commit

    • 9f06d841 - Remove wrong argument in removeAttribute

    Compare with previous version

  • mentioned in commit fa68c761

  • Please register or sign in to reply
    Loading