diff options
| author | Michael Howell <michael@notriddle.com> | 2022-10-17 14:20:04 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-10-17 19:26:15 -0700 |
| commit | d4e4b08b9b53f3dda7be3cc3bf8881db4180f736 (patch) | |
| tree | 78fc8d021ad8b0644aa59da4ef0e588d8f875965 /src/librustdoc/html/static/js/main.js | |
| parent | bbac29c0950c780af5a9aea707d4ff30c046be45 (diff) | |
| download | rust-d4e4b08b9b53f3dda7be3cc3bf8881db4180f736.tar.gz rust-d4e4b08b9b53f3dda7be3cc3bf8881db4180f736.zip | |
rustdoc: change mobile breakpoint to match CSS
Since it's possible to have a 700.5px viewport width, the JS needs to not switch to mobile mode in such a setup.
Diffstat (limited to 'src/librustdoc/html/static/js/main.js')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 3bcadcda534..1251d6bfda3 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -737,7 +737,7 @@ function loadCss(cssFileName) { window.rustdocMobileScrollLock = function() { const mobile_topbar = document.querySelector(".mobile-topbar"); - if (window.innerWidth < window.RUSTDOC_MOBILE_BREAKPOINT) { + if (window.innerWidth <= window.RUSTDOC_MOBILE_BREAKPOINT) { // This is to keep the scroll position on mobile. oldSidebarScrollPosition = window.scrollY; document.body.style.width = `${document.body.offsetWidth}px`; @@ -783,7 +783,7 @@ function loadCss(cssFileName) { } window.addEventListener("resize", () => { - if (window.innerWidth >= window.RUSTDOC_MOBILE_BREAKPOINT && + if (window.innerWidth > window.RUSTDOC_MOBILE_BREAKPOINT && oldSidebarScrollPosition !== null) { // If the user opens the sidebar in "mobile" mode, and then grows the browser window, // we need to switch away from mobile mode and make the main content area scrollable. |
