Skip to content

Commit

Permalink
Merge pull request #5527 from smithellis/fix-lazyload
Browse files Browse the repository at this point in the history
loadnow for docs
  • Loading branch information
akatsoulas committed Jun 6, 2023
2 parents 827e66a + 3a28295 commit 128167f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kitsune/sumo/static/sumo/js/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@ function addReferrerAndQueryToVoteForm() {
.append($('<input type="hidden" name="referrer"/>').attr("value", referrer))
.append($('<input type="hidden" name="query"/>').attr("value", query));
}

// For this singular document, we are going to load
// all images and then scroll to the anchor.
// TODO: We need a fix for the whole KB that won't
// break the lazy loading.
$(window).on("load", function() {
if(window.location.href.indexOf("relay-integration") > -1) {
$("img.lazy").loadnow(); // Load all images
// Wait for all content (including images) to load
var hash = window.location.hash;
window.location.hash = ""; // Clear the hash initially
setTimeout(function() {
window.location.hash = hash; // Restore the hash after all images are loaded
}, 0);
}
});

0 comments on commit 128167f

Please sign in to comment.