Sha256: a9444f3e702eef45ca5ffe4c8b8135e187482ff19401dce2823e8951d624fe1f
Contents?: true
Size: 1.04 KB
Versions: 23
Compression:
Stored size: 1.04 KB
Contents
document.addEventListener('DOMContentLoaded', function() { "use strict"; sticky(); }); /*----------------------*/ /* Sticky Sidebar */ /*----------------------*/ function sticky() { $.fn.scrollBottom = function() { return $(document).height() - this.scrollTop() - this.height(); }; var $el = $('#sidebar'); var $window = $(window); var top = $el.parent().position().top; $window.bind("scroll resize", function() { var gap = $window.height() - $el.height() - -35; var visibleFoot = 965 - $window.scrollBottom(); var scrollTop = $window.scrollTop() if (scrollTop < top + -35) { $el.css({ top: (top - scrollTop) + "px", bottom: "auto" }); } else if (visibleFoot > gap) { $el.css({ top: "auto", bottom: visibleFoot + "px" }); } else { $el.css({ top: -35, bottom: "auto" }); } }).scroll(); }
Version data entries
23 entries across 23 versions & 1 rubygems