Commit ab83c1e4 authored by Lukas Eipert's avatar Lukas Eipert

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
......@@ -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);
}
......
---
title: Fix Image Lazy Loader for some older browsers
merge_request:
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment