Skip to content

Commit

Permalink
Limit "auto scroll ToC" to Chromium-based
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed May 7, 2024
1 parent 70462d0 commit 573f286
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Disable copy button on invalid syntax highlighting blocks to avoid positioning issues.
- Fix typo for `fa-dribble` in `_utilities.scss`.
- Restrict "auto scroll sticky ToC to content" feature to Chromium browsers for now. [#4826](https://github.com/mmistakes/minimal-mistakes/issues/4826)

### Documentation & Maintenance

Expand Down
9 changes: 7 additions & 2 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $(document).ready(function () {
}

// Auto scroll sticky ToC with content
document.addEventListener("gumshoeActivate", function (event) {
const scrollTocToContent = function (event) {
var target = event.target;
var scrollOptions = { behavior: "auto", block: "nearest", inline: "start" };

Expand All @@ -75,7 +75,12 @@ $(document).ready(function () {
} else {
target.scrollIntoView(scrollOptions);
}
});
};

// Has issues on Firefox, whitelist Chrome for now
if (!!window.chrome) {
document.addEventListener("gumshoeActivate", scrollTocToContent);
}

// add lightbox class to all image links
$(
Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/main.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/_docs/18-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ permalink: "/docs/history/"
excerpt: Change log of enhancements and bug fixes made to the theme.
sidebar:
nav: docs
last_modified_at: '2024-05-06T21:37:37+08:00'
last_modified_at: '2024-05-07T14:20:29+08:00'
toc: false
---

Expand All @@ -21,6 +21,7 @@ toc: false

- Disable copy button on invalid syntax highlighting blocks to avoid positioning issues.
- Fix typo for `fa-dribble` in `_utilities.scss`.
- Restrict "auto scroll sticky ToC to content" feature to Chromium browsers for now. [#4826](https://github.com/mmistakes/minimal-mistakes/issues/4826)

### Documentation & Maintenance

Expand Down

0 comments on commit 573f286

Please sign in to comment.