WordPress.org

Ready to get started?Download WordPress

Forums

WP Tiles
wp tiles & lazy load (3 posts)

  1. arne.saknussem
    Member
    Posted 7 months ago #

    Hi!

    I must say that I love your plugin.
    Since I like it so much, I loaded my first page with tons of picures.
    This is giving me some performance problems in terms of loading times.

    I've been trying to modify some jquery code to use WP Tiles in combinationn with lazy load plugin (http://wordpress.org/plugins/lazy-load/). Unfortunately I'm not a jquery ninja. Could you give me a help?

    Thanks.
    A.

    http://wordpress.org/plugins/wp-tiles/

  2. Mike
    Member
    Plugin Author

    Posted 7 months ago #

    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

  3. arne.saknussem
    Member
    Posted 7 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic