Lazy load, placeholders, ToC and Gutenberg problem
-
I have a problem with lazy load, image placeholders, Gutenberg WP Editor, and anchors to the post sections (Table of Content).
In all posts, I have a Table of Content that links to the headers and sections of my post (h1, h2). But if I turn on lazy load, the links not working correctly and they scrolled to the random position of my post. Smooth scroll in CSS doesn’t help. All because of the images that have not yet been loaded.
The solution to the problem should be image placeholders that have height just like images in my posts, but Gutenberg in Image block doesn’t add width and height parameter to img. Even if I choose image dimensions in WordPress editor, the image is responsive (have scrset). That’s OK, but I think because of that, the lazy load can’t generate a placeholder. So, links in my ToC linked to a random place of my post.
How to solve this problem?
Force Gutenberg somehow to auto add width/height to all images code? Or do something in lazy load code?I hope for your help.
- The topic ‘Lazy load, placeholders, ToC and Gutenberg problem’ is closed to new replies.