Skip to content

Commit

Permalink
Fix #1186: Affix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jan 16, 2020
1 parent bd56c0f commit 7bf7e06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/js/schemes/pisces.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ var Affix = {
getState: function(scrollHeight, height, offsetTop, offsetBottom) {
let scrollTop = window.scrollY;
let targetHeight = window.innerHeight;
if (offsetTop != null && this.affixed === 'top') return scrollTop < offsetTop ? 'top' : false;
if (offsetTop != null && this.affixed === 'top') {
if (document.querySelector('.content-wrap').offsetHeight < offsetTop) return 'top';
return scrollTop < offsetTop ? 'top' : false;
}
if (this.affixed === 'bottom') {
if (offsetTop != null) return this.unpin <= this.element.getBoundingClientRect().top ? false : 'bottom';
return scrollTop + targetHeight <= scrollHeight - offsetBottom ? false : 'bottom';
Expand Down

0 comments on commit 7bf7e06

Please sign in to comment.