luis-almeida / unveil

A very lightweight jQuery plugin to lazy load images
4.15k stars 675 forks source link

Not Working if Data-Src set dynamically #59

Closed DSigmund closed 10 years ago

DSigmund commented 10 years ago

I am trying to implement unveil on every page in my website. So i just write the src of all images on page load in the img-data-src.

See here: http://jsfiddle.net/g5JxF/

Thanks for your very nice plugin :-)

luis-almeida commented 10 years ago

Works for me: http://jsfiddle.net/g5JxF/3/

Set the data-src attribute using jQuery's .attr method instead of .data which doesn't actually changes the data-src attribute.

Also, if your images are within the viewport, they'll be unveiled right away.

DSigmund commented 10 years ago

Thanks for the quick and easy answer :-) :+1: