Skip to content

Commit

Permalink
Closes academicpages#1975 RM stickyfill in favor of native browser su…
Browse files Browse the repository at this point in the history
…pport
  • Loading branch information
rjzupkoii committed Sep 15, 2024
1 parent 9dc8535 commit ff87a34
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 45 deletions.
35 changes: 0 additions & 35 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,6 @@ $(document).ready(function(){
// FitVids init
fitvids();

// init sticky sidebar
$(".sticky").Stickyfill();

var stickySideBar = function(){
const MINIMUM_WIDTH = 1024;

// Adjust if the follow button is shown based upon screen size
var width = $(window).width();
var show = $(".author__urls-wrapper button").length === 0 ? width > MINIMUM_WIDTH : !$(".author__urls-wrapper button").is(":visible");

// Don't show the follow button if there is no content for it
var count = $('.author__urls.social-icons li').length - $('li[class="author__desktop"]').length;
if (width <= MINIMUM_WIDTH && count === 0) {
$(".author__urls-wrapper button").hide();
show = false;
}

if (show) {
// fix
Stickyfill.rebuild();
Stickyfill.init();
$(".author__urls").show();
} else {
// unfix
Stickyfill.stop();
$(".author__urls").hide();
}
};

stickySideBar();

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

// Follow menu drop down
$(".author__urls-wrapper button").on("click", function() {
$(".author__urls").fadeToggle("fast", function() {});
Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.min.js

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions assets/js/plugins/stickyfill.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"uglify-js": "^3.17.4"
},
"scripts": {
"uglify": "uglifyjs node_modules/jquery/dist/jquery.min.js node_modules/fitvids/dist/fitvids.min.js node_modules/magnific-popup/dist/jquery.magnific-popup.min.js node_modules/jquery-smooth-scroll/jquery.smooth-scroll.min.js assets/js/plugins/jquery.greedy-navigation.js assets/js/plugins/stickyfill.min.js assets/js/_main.js -c -m -o assets/js/main.min.js",
"uglify": "uglifyjs node_modules/jquery/dist/jquery.min.js node_modules/fitvids/dist/fitvids.min.js node_modules/magnific-popup/dist/jquery.magnific-popup.min.js node_modules/jquery-smooth-scroll/jquery.smooth-scroll.min.js assets/js/plugins/jquery.greedy-navigation.js assets/js/_main.js -c -m -o assets/js/main.min.js",
"watch:js": "onchange \"assets/js/**/*.js\" -e \"assets/js/main.min.js\" -- npm run build:js",
"build:js": "npm run uglify"
}
Expand Down

0 comments on commit ff87a34

Please sign in to comment.