Issue with mobile devices
reaganap opened this issue · comments
Great library.
Though I was having issue with mobile devices in trying to get the correct view port size. Made slight modification below to make it work just for use in mobile sites. Please let me know what you think.
-
_inView
-
@param {Element} element Image element
-
@returns {Boolean} Is element in viewport
*/
var _inView = function (element) {
var coords = element.getBoundingClientRect();
return ((coords.top >= 0 && coords.left >= 0 && coords.top) <= (_returnHeight()) + offset);
};- _returnHeight
-
@returns height of viewport
*/var _returnHeight = function() {
return Math.min(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight,
window.innerHeight, screen.height
);
}
Fixes made in latest version.