Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Eipert <leipert@gitlab.com>2018-11-26 16:26:23 +0300
committerLukas Eipert <leipert@gitlab.com>2018-11-26 16:29:34 +0300
commitab83c1e419b25436e76ed94f06e056f0bb1f4d53 (patch)
treeefcd429d8742ab15e962736bf2c36c0be5c3147e /app/assets/javascripts/lazy_loader.js
parent1c1b7a820db168974289039acd9f1f89664b684e (diff)
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.
Diffstat (limited to 'app/assets/javascripts/lazy_loader.js')
-rw-r--r--app/assets/javascripts/lazy_loader.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/assets/javascripts/lazy_loader.js b/app/assets/javascripts/lazy_loader.js
index af50ea9d6c2..ee01a73a6e8 100644
--- a/app/assets/javascripts/lazy_loader.js
+++ b/app/assets/javascripts/lazy_loader.js
@@ -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);
}