Line 152: | Line 152: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
$(window).scroll(function() { | $(window).scroll(function() { | ||
− | + | var scrollPercentage = (document.documentElement.scrollTop + document.body.scrollTop) / (document.documentElement.scrollHeight - document.documentElement.clientHeight); | |
− | + | if(scrollPercentage >= 0.95) { | |
+ | var position = $("#sidelist").position(); | ||
if(position == undefined){} | if(position == undefined){} | ||
else{ | else{ | ||
− | $('#sidelist').css({"position": "fixed", "top": "105px | + | $('#sidelist').css({"position": "fixed", "top": "105px"}); |
} | } | ||
} else { | } else { | ||
− | $('#sidelist').removeAttr('style'); | + | if ($(this).scrollTop() >= 50) { |
− | } | + | var position = $("#sidelist").position(); |
+ | if(position == undefined){} | ||
+ | else{ | ||
+ | $('#sidelist').css({"position": "fixed", "top": "105px", "margin-top": "0px"}); | ||
+ | } | ||
+ | } else { | ||
+ | $('#sidelist').removeAttr('style'); | ||
+ | } | ||
+ | } | ||
}); | }); | ||
$(function(){ | $(function(){ |
Revision as of 15:26, 12 September 2018