mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
&[data-state="unloaded"], &[data-state="loading"] {
|
&[data-state="unloaded"], &[data-state="loading"] {
|
||||||
display: inherit;
|
display: inherit;
|
||||||
height: 2rem;
|
height: 1rem;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ define('forum/topic/posts', [
|
|||||||
'components'
|
'components'
|
||||||
], function(pagination, infinitescroll, postTools, navigator, components) {
|
], function(pagination, infinitescroll, postTools, navigator, components) {
|
||||||
|
|
||||||
var Posts = {
|
var Posts = {};
|
||||||
_threshold: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
Posts.onNewPost = function(data) {
|
Posts.onNewPost = function(data) {
|
||||||
if (!data || !data.posts || !data.posts.length) {
|
if (!data || !data.posts || !data.posts.length) {
|
||||||
@@ -257,7 +255,6 @@ define('forum/topic/posts', [
|
|||||||
If no threshold is defined, loaded images will push down content, as per
|
If no threshold is defined, loaded images will push down content, as per
|
||||||
default
|
default
|
||||||
*/
|
*/
|
||||||
Posts._threshold = threshold;
|
|
||||||
|
|
||||||
var images = components.get('post/content').find('img[data-state="unloaded"]'),
|
var images = components.get('post/content').find('img[data-state="unloaded"]'),
|
||||||
visible = images.filter(function() {
|
visible = images.filter(function() {
|
||||||
@@ -275,7 +272,7 @@ define('forum/topic/posts', [
|
|||||||
newHeight = document.body.clientHeight;
|
newHeight = document.body.clientHeight;
|
||||||
|
|
||||||
var imageRect = this.getBoundingClientRect();
|
var imageRect = this.getBoundingClientRect();
|
||||||
if (imageRect.top < Posts._threshold) {
|
if (imageRect.top < threshold) {
|
||||||
scrollTop = scrollTop + (newHeight - oldHeight);
|
scrollTop = scrollTop + (newHeight - oldHeight);
|
||||||
$(window).scrollTop(scrollTop);
|
$(window).scrollTop(scrollTop);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user