Skip to content
Snippets Groups Projects
Unverified Commit ab83c1e4 authored by Lukas Eipert's avatar Lukas Eipert
Browse files

Use intersectionRatio to determine intersection

Some older browsers do not ship with isIntersecting, while they already
have IntersectionObserver support. We make use of `intersectionRatio`
now to fix the Lazy Loader for those browsers.
parent 1c1b7a82
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -91,7 +91,9 @@ export default class LazyLoader {
 
onIntersection = entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
// We are using `intersectionRatio > 0` over `isIntersecting`, as some browsers did not ship the latter
// See: https://gitlab.com/gitlab-org/gitlab-ce/issues/54407
if (entry.intersectionRatio > 0) {
this.intersectionObserver.unobserve(entry.target);
this.lazyImages.push(entry.target);
}
Loading
Loading
---
title: Fix Image Lazy Loader for some older browsers
merge_request:
author:
type: fixed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment