Skip to content

Commit

Permalink
refactor(v2): use translateY instead of top to hide navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Feb 8, 2021
1 parent 5871d1b commit 0a1e29a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
}

.navbarHideable {
transition: top 0.2s ease-in-out;
transform: translateY(0);
transition: transform var(--ifm-transition-fast) ease;
}

.navbarHidden {
top: calc(var(--ifm-navbar-height) * -1) !important;
transform: translateY(calc(var(--ifm-navbar-height) * -1));
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {useHideableNavbarReturns} from '@theme/hooks/useHideableNavbar';

const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
const location = useLocation();
const [isNavbarVisible, setIsNavbarVisible] = useState(!hideOnScroll);
const [isNavbarVisible, setIsNavbarVisible] = useState(hideOnScroll);
const isFocusedAnchor = useRef(false);
const [lastScrollTop, setLastScrollTop] = useState(0);
const [navbarHeight, setNavbarHeight] = useState(0);
Expand Down

0 comments on commit 0a1e29a

Please sign in to comment.