Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Possibility to lazyload background-images #9

Open
fliespl opened this issue May 10, 2020 · 1 comment
Open

Feature Request: Possibility to lazyload background-images #9

fliespl opened this issue May 10, 2020 · 1 comment

Comments

@fliespl
Copy link

fliespl commented May 10, 2020

Possibly using some other data tag like data-bg?

@cdowdy
Copy link
Owner

cdowdy commented May 27, 2020

Sorry @fliespl I got sidetracked and completely forgot about this...

Anyways... I probably should have listened to @pedrosanta since they had better foresight than I did when they did the "visible" class pull here #7

Would allowing the lazyload class (or whatever you're using) to be attached to say a div like so:

<div class="lazyload lazyload-bg-example" data-src="a-image.jpg"></div>

work for most cases?

This would allow for a either using css alone to apply the image like:

// placeholder image
.lazyload-bg-example { 
  background-image: url('low-quality-placeholder.jpg');
}

// image applied once the 'visible' class is set
.lazyload-bg-example .visibile {
  background-image: url('lazy-loaded-image.jpg');
}

or you could use the data-src and apply it inline with css or your own javascript ?

That sound like ti would be workable to your or anyone else reading this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants