lazyload attributes saved into page content
-
after one of the recent updates on my site the cover image and the first project thumbnail on the homepage were not displayed when the page was loaded directly (in all browsers, on desktop and mobile). However, they did appear correctly when navigating to the homepage from a subpage (via AJAX navigation), and they also look fine in the Laytheme editor.
Claude found the problem and gave me a script to solve the problem for the moment.
<script>
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll("img[data-src]").forEach(function (img) {
if (img.src.indexOf("data:image") === 0) {
img.removeAttribute("sizes");
img.src = img.getAttribute("data-src");
}
});
});
</script>But I guess it is a bug?
Thanks in advance for looking into this.
For paid 1-on-1 Lay Theme Coaching, contact Audrey (audrey@cyberslayers.work) or me (info@laytheme.com).
We also code custom websites or bespoke Lay features. Drop me a line at info@laytheme.com or check out my work at arminunruh.com.
Want to support my work? paypal.me/arminunruh
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it