Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
try to fix firefox android bug (see #524)
Browse files Browse the repository at this point in the history
  • Loading branch information
aFarkas committed Jun 24, 2015
1 parent 568f100 commit 261d1d5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/plugins/gecko-picture/pf.gecko-picture.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* FF's first picture implementation is static and does not react to viewport changes, this tiny script fixes this.
*/
(function() {
(function(window) {
/*jshint eqnull:true */
var ua = navigator.userAgent;

Expand Down Expand Up @@ -36,21 +36,24 @@
var i;
var imgs = document.querySelectorAll("picture > img, img[srcset][sizes]");
for (i = 0; i < imgs.length; i++) {
if (imgs[i].currentSrc && !imgs[i].complete) {
removeEventListener("resize", onResize);
break;
}
fixRespimg(imgs[i]);
}
};
var onResize = function() {
clearTimeout(timer);
timer = setTimeout(findPictureImgs, 99);
};
var mq = window.matchMedia && matchMedia("(orientation: landscape)");

dummySrc.srcset = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";

onResize();

if (mq && mq.addListener) {
mq.addListener(onResize);
}

return onResize;
})());
}
})();
})(window);

0 comments on commit 261d1d5

Please sign in to comment.