thinker3197 / progressively

A JavaScript library to load images progressively 🌇
https://thinker3197.github.io/progressively
MIT License
698 stars 68 forks source link

Added function for medium-quality image for small screens and support for background-images #21

Closed Sebiworld closed 7 years ago

Sebiworld commented 7 years ago

Hi thinker3197, I really appreciate your work on progressively. For a new project I developed those improvements to make progressively usable in more scopes of application.

Now you can add a medium-quality image with data-progressively-sm, which will be loaded on smaller screen-widths. If the screensize increases, the full-size will be loaded. Additionaly I've added support for css-background-images.

Look at the README.md for detailed information. I would be glad if you could accept my pull request.

Sebiworld commented 7 years ago

Hi @thiamsantos , thanks for your feedback! I don't usually code in standardjs-codingstyle, but I hope the progressively.js-file fulfills this standard now.

thiamsantos commented 7 years ago

Looks good to me! Great work @Sebiworld :tada:

Let's see what @thinker3197 think.

Sebiworld commented 7 years ago

Thanks @thinker3197 !

I agree with you concerning the ambiguous return-value of loadImage. But that was the first and simplest solution that came to my mind.

Otherwise, I could return an integer-value from some kind of global constants-array, or I could check elem.classList.contains('progressive--loaded-sm') after loadImage. What do you think?

Sebiworld commented 7 years ago

Tadaaa! Now I check for presence of progressive--loaded-sm instead of working with boolean as return value. If it was up to me, I would merge it to progressively's master-branch 👍

thinker3197 commented 7 years ago

Merging in master. Again, thanks for the pr @Sebiworld.