WordPress.org

Support

Support » Plugins and Hacks » WP Tiles » wp tiles & lazy load

wp tiles & lazy load

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mike Martel

    @mike_cowobo

    Hi Arne,

    I’m afraid that Lazy Load + WP Tiles is not going to work. WP Tiles uses a div background image to show images, while Lazy Load lazy loads images that come as a <img> tag.

    There would be two ways to work around it, both being quite involved:

    1. Make WP Tiles use images instead of divs with background

    If you modify the tile template in the JS (in wp-tiles.js around line 72) to use an image instead of a div, you could then further hardcode the lazy load data in there:
    <img src="[insert the placeholder img url/data here]" data-lazy-src="[insert wp-tiles image gere]">

    2. Create a lazy-load script for WP Tiles

    Google around for lazy load div background images. You’ll find scripts like this one. Then you just have to change wp-tiles (same spot in the JS) to set the background image in a data attribute.

    Good luck and report back if you had any luck! Maybe it’s a neat feature to have for a future version of WP Tiles as well 🙂

    Mike

    Well, I was thinking it would be great to see it in the new version of wp tiles.
    I’ll let you know.

    Thanks for your quick answer!
    My best,
    A.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp tiles & lazy load’ is closed to new replies.
Skip to toolbar