callmecavs / layzr.js

A modern lazy loading library for images.

Home Page:http://callmecavs.com/layzr.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Background images and the src attribute

ryankask opened this issue · comments

I use this library to set background images based on the example posted in #54.

I noticed that the private setSource() function (unsurprisingly) set's the element's src attribute.

For the background image functionality, however, this isn't needed.

Have you thought about this? Is there a simple way to stop this from happening without making the library a lot more complicated? Perhaps it doesn't matter?

Thanks for the great library.

@ryankask hey dude, my recommendation would be to use the new events to deal with the src attribute as you choose. you can remove it in the after event, and set it as an inline style background image instead.