Skip to content

Commit

Permalink
Remove "sticky sidebar" JS in favor of CSS media queries
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed May 5, 2024
1 parent 4364fb7 commit c76813f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fix an unclosed `<p>` tag in `page__hero.html`, near `page.header.actions`.
- Remove overlay and revert X to hamburger icon when popup disappears. [#3958](https://github.com/mmistakes/minimal-mistakes/pull/3958)
- Fix SEO title when it contains a vertical bar. [#3094](https://github.com/mmistakes/minimal-mistakes/pull/3094) [#3113](https://github.com/mmistakes/minimal-mistakes/pull/3113)
- Remove "sticky sidebar" JS as it's now completely based on CSS media queries. [#4245](https://github.com/mmistakes/minimal-mistakes/issues/4245) [#4645](https://github.com/mmistakes/minimal-mistakes/pull/4645)

### Enhancements

Expand Down
21 changes: 0 additions & 21 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,6 @@ $(function() {
// FitVids init
$("#main").fitVids();

// Sticky sidebar
var stickySideBar = function() {
var show =
$(".author__urls-wrapper").find("button").length === 0
? $(window).width() > 1024 // width should match $large Sass variable
: !$(".author__urls-wrapper").find("button").is(":visible");
if (show) {
// fix
$(".sidebar").addClass("sticky");
} else {
// unfix
$(".sidebar").removeClass("sticky");
}
};

stickySideBar();

$(window).resize(function() {
stickySideBar();
});

// Follow menu drop down
$(".author__urls-wrapper").find("button").on("click", function() {
$(".author__urls").toggleClass("is--visible");
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-05T18:13:22+08:00'
last_modified_at: '2024-05-05T18:22:58+08:00'
toc: false
---

Expand All @@ -22,6 +22,7 @@ toc: false
- Fix an unclosed `<p>` tag in `page__hero.html`, near `page.header.actions`.
- Remove overlay and revert X to hamburger icon when popup disappears. [#3958](https://github.com/mmistakes/minimal-mistakes/pull/3958)
- Fix SEO title when it contains a vertical bar. [#3094](https://github.com/mmistakes/minimal-mistakes/pull/3094) [#3113](https://github.com/mmistakes/minimal-mistakes/pull/3113)
- Remove "sticky sidebar" JS as it's now completely based on CSS media queries. [#4245](https://github.com/mmistakes/minimal-mistakes/issues/4245) [#4645](https://github.com/mmistakes/minimal-mistakes/pull/4645)

### Enhancements

Expand Down

0 comments on commit c76813f

Please sign in to comment.