Skip to content

Commit aa0222e

Browse files
author
daya
committed
fix: add comments
1 parent 04878f9 commit aa0222e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

layout/_third-party/comments/disqus.swig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828
loadComments();
2929
} else {
3030
$(window).on('scroll.disqus_scroll', function () {
31+
// offsetTop may changes because of manually resizing browser window or lazy loading images.
32+
var offsetTop = $('#comments').offset().top - $(window).height();
3133
var scrollTop = $(window).scrollTop();
32-
if (scrollTop >= offsetTop) {
34+
35+
// pre-load comments a bit? (margin or anything else)
36+
if (offsetTop - scrollTop < 60) {
3337
$(window).off('.disqus_scroll');
3438
loadComments();
3539
}

0 commit comments

Comments
 (0)