Fix stuck sidebar when resizing viewport

Close #1447
This commit is contained in:
Michael Rose
2018-01-03 14:20:41 -05:00
parent 0db0f31953
commit e2b50a355f
3 changed files with 40 additions and 13 deletions

View File

@@ -24,6 +24,27 @@ $(document).ready(function() {
// FitVids init
$("#main").fitVids();
// Sticky sidebar
var stickySideBar = function() {
var show =
$(".author__urls-wrapper button").length === 0
? $(window).width() > 1024 // width should match $large Sass variable
: !$(".author__urls-wrapper 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 button").on("click", function() {
$(".author__urls").toggleClass("is--visible");

10
assets/js/main.min.js vendored

File diff suppressed because one or more lines are too long