Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Fixed the correct initial calculation of the offset. #456

Merged
merged 1 commit into from
Mar 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/stickybits.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class Stickybits {
: el.offsetHeight
const parentBottom = stickyStart + parent.offsetHeight
it.offset = scrollElOffset + p.stickyBitStickyOffset
it.stickyStart = isTop ? stickyStart - it.offset : 0
it.stickyStart = isTop ? stickyStart : 0
it.stickyChange = it.stickyStart + stickyChangeOffset
it.stickyStop = isTop
? parentBottom - (el.offsetHeight + it.offset)
Expand Down Expand Up @@ -330,7 +330,7 @@ class Stickybits {
stl.position = pv
if (ns) return
stl.bottom = ''
stl[vp] = `${p.stickyBitStickyOffset}px`
stl[vp] = `${it.offset}px`
})
} else if (isSticky) {
it.state = 'default'
Expand Down