Unlike the original, this is a unique approach to prevent images from loading when nested within hidden <div>
elements, utilizing the document.ready
method which unfortunately fails to deliver desired results.
The issue lies in the fact that by the time the JavaScript executes, the browser has already initiated the download process for these undesired images.
$(document).ready(function() {
$('div').not(":visible").each(function () {
$(this).find('img').each(function() {
$(this).attr("src","");
});
});
});
Seeking advice on a more effective JavaScript solution to tackle this problem. Alternatively, considering the use of <img srctmp="...."/>
and dynamically replacing srctmp
with src
through JavaScript for images not enclosed within hidden <div>
elements.