update aside scroll

Signed-off-by: liuboaibc <kukudehero@gmail.com>
This commit is contained in:
liuboaibc 2020-09-27 10:09:50 +08:00
parent c01c44c3ce
commit e86fa55810

View File

@ -5,7 +5,7 @@ var getElementTopToScreenTop = function(element) {
}
var getElementBottomToScreenBottom = function(element) {
return $(window).height() + $(document).scrollTop() - element.offset().top - element.height()
return $(window).height() + $(document).scrollTop() - element.offset().top - element.outerHeight()
}
var getElementBottomToTop = function(element) {
@ -44,7 +44,7 @@ var scrollEvent = function(content, aside, asideInner) {
$( window ).scroll(function() {
var headerHeight = $('header').outerHeight()
var contentToTop = getElementTopToScreenTop(content)
if (contentToTop < headerHeight) {
if (contentToTop < headerHeight + 10) {
aside.css("top", headerHeight + 10)
aside.css("bottom", 10)
var s1 = getElementBottomToTop(content)