You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my website I have been experiencing a problem with the script where it doesn't detect correctly whether an element is in view or not. It's because some images on my website ( bredymer.dk/biler.aspx ) return ele.getBoundingClientRect().left value less than zero meaning that their left coordinate starts outside viewport. This has caused some of the images not to load and I fixed it by
I have fixed it by modifying
function elementInView(ele) {
var rect = ele.getBoundingClientRect();
var bottomline = winHeight + options.offset;
return (
// inside horizontal view
rect.left >= -20
&& rect.right <= winWidth + options.offset
&& (
// from top to bottom
rect.top >= 0
&& rect.top <= bottomline
// from bottom to top
|| rect.bottom <= bottomline
&& rect.bottom >= 0 - options.offset
)
);
return inView;
}
where I set rect.left >= -20 . This is not a universal solution and only helped fixed problem in my website. Perhaps there are some universal ways to solve it?
The text was updated successfully, but these errors were encountered:
On my website I have been experiencing a problem with the script where it doesn't detect correctly whether an element is in view or not. It's because some images on my website ( bredymer.dk/biler.aspx ) return ele.getBoundingClientRect().left value less than zero meaning that their left coordinate starts outside viewport. This has caused some of the images not to load and I fixed it by
I have fixed it by modifying
where I set rect.left >= -20 . This is not a universal solution and only helped fixed problem in my website. Perhaps there are some universal ways to solve it?
The text was updated successfully, but these errors were encountered: