unveil icon indicating copy to clipboard operation
unveil copied to clipboard

Lazy Load responsive background images?

Open csdougliss opened this issue 9 years ago • 5 comments

I've been using unveil for a while and I was searching for something that does BG images. I found lazysizes, bgset and respimg.js and they do what I want but in total we are looking at 11.5 KB.

I like unveil's small size, so would it be possible with unveil?

html is like so:

<div class="category-top-banner lazyload" data-bgset="' . $this->getSmallImageUrl() . ' [(max-width: 650px)] | ' . $this->getLargeImageUrl() . '"' : ""; ?>>
</div>

csdougliss avatar Jun 30 '15 13:06 csdougliss

It wouldn't support it currently. However, I imagine it could be modified to do so.

timbunch avatar Sep 01 '15 17:09 timbunch

I wanted it to do this too. I made a small change to check if it's acting on a img tag (then set src) or acting on something else then set the background-image to the data-src value https://github.com/pau1phi11ips/unveil/blob/master/jquery.unveil.js

pau1phi11ips avatar Feb 18 '16 13:02 pau1phi11ips

I need this feature too.

lynnic26 avatar May 25 '16 03:05 lynnic26

@pau1phi11ips Thanks! You might want to push the new 1.3.1 tag to your repo so that it can be installed by doing $ bower install pau1phi11ips/unveil, otherwise you need to add a git ref.

thewarpaint avatar Jul 20 '16 23:07 thewarpaint

How would use this? Like this?

$(function() { $("div.Bg-img-clas").unveil(300); });

1-800-jono avatar Feb 15 '17 19:02 1-800-jono