Skip to content

Commit

Permalink
Removed "height:0" for images with unknown height (img.responsively-l…
Browse files Browse the repository at this point in the history
…azy), because they are not visible in unsupported browsers.
  • Loading branch information
ivopetkov committed Dec 19, 2015
1 parent ede9595 commit ee6ad9e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Let's not break it when we can enhance it.

## Browser support

The lazy loading works in browsers supporting the srcset attribute. As of August 2015 that's [62.78%](http://caniuse.com/#feat=srcset). Unsupported browsers will load the image in the src attribute. That's the image search engines and social networks will find, so it's better to make it high resolution.
The lazy loading works in browsers supporting the srcset attribute. As of December 2015 that's [66.47%](http://caniuse.com/#feat=srcset). Unsupported browsers will load the image in the src attribute. That's the image search engines and social networks will find, so it's better to make it high resolution.

## License
Free to use under the [MIT license](http://opensource.org/licenses/MIT).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "responsively-lazy",
"title": "Responsively Lazy",
"version": "1.2.0",
"version": "1.2.1",
"description": "Lazy load responsive images",
"homepage": "http://ivopetkov.com/b/lazy-load-responsive-images/",
"author": {
Expand Down
1 change: 0 additions & 1 deletion responsivelyLazy.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@

img.responsively-lazy{
width:100%;
height:0;
}
3 changes: 0 additions & 3 deletions responsivelyLazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ if (typeof responsivelyLazy === 'undefined') {
if (container.lastSetOption[1] < bestSelectedOption[1]) {
container.lastSetOption = bestSelectedOption;
element.setAttribute('srcset', bestSelectedOption[0]);
if (unknownHeight) {
element.style.height = "auto";
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion responsivelyLazy.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* Copyright 2015, Ivo Petkov
* Free to use under the MIT license.
*/
.responsively-lazy:not(img){position:relative;height:0}.responsively-lazy:not(img) img{position:absolute;top:0;left:0;width:100%;height:100%}img.responsively-lazy{width:100%;height:0}
.responsively-lazy:not(img){position:relative;height:0}.responsively-lazy:not(img) img{position:absolute;top:0;left:0;width:100%;height:100%}img.responsively-lazy{width:100%;}
10 changes: 5 additions & 5 deletions responsivelyLazy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ee6ad9e

Please sign in to comment.