mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
actually don't delay image loading when "delay image loading" is unchecked
This commit is contained in:
@@ -239,11 +239,13 @@ define('forum/topic/posts', [
|
|||||||
Posts.unloadImages = function(posts) {
|
Posts.unloadImages = function(posts) {
|
||||||
var images = posts.find('[component="post/content"] img:not(.not-responsive)');
|
var images = posts.find('[component="post/content"] img:not(.not-responsive)');
|
||||||
|
|
||||||
images.each(function() {
|
if (config.delayImageLoading) {
|
||||||
$(this).attr('data-src', $(this).attr('src'));
|
images.each(function() {
|
||||||
$(this).attr('data-state', 'unloaded');
|
$(this).attr('data-src', $(this).attr('src'));
|
||||||
$(this).attr('src', 'about:blank');
|
}).attr('data-state', 'unloaded').attr('src', 'about:blank');
|
||||||
});
|
} else {
|
||||||
|
images.attr('data-state', 'loaded');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Posts.loadImages = function(threshold) {
|
Posts.loadImages = function(threshold) {
|
||||||
@@ -263,7 +265,7 @@ define('forum/topic/posts', [
|
|||||||
|
|
||||||
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() {
|
||||||
return config.delayImageLoading ? utils.isElementInViewport(this) : true;
|
return utils.isElementInViewport(this);
|
||||||
}),
|
}),
|
||||||
scrollTop = $(window).scrollTop(),
|
scrollTop = $(window).scrollTop(),
|
||||||
adjusting = false,
|
adjusting = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user