@glitchr/transparent 1.0.20 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -211,7 +211,7 @@
211
211
  dispatchEvent(new Event('transparent:'+Transparent.state.ACTIVE));
212
212
  }
213
213
 
214
- window.addEventListener("DOMContentLoaded", function()
214
+ window.addEventListener("load", function()
215
215
  {
216
216
  Transparent.loader = $($(document).find(Settings.loader)[0] ?? Transparent.html);
217
217
  Transparent.lazyLoad();
@@ -1040,27 +1040,28 @@
1040
1040
  lazyloadImages = lazyloadImages || document.querySelectorAll("img[data-src]:not(.loaded)");
1041
1041
  if ("IntersectionObserver" in window) {
1042
1042
 
1043
+ let options = { root:null, rootMargin: "100%" };
1043
1044
  var imageObserver = new IntersectionObserver(function (entries, observer) {
1044
1045
  entries.forEach(function (entry) {
1045
1046
  if (entry.isIntersecting) {
1046
1047
  var image = entry.target;
1047
1048
  var lazybox = image.closest(".lazybox");
1048
1049
 
1049
- image.onload = function() {
1050
- this.classList.add("loaded");
1051
- this.classList.remove("loading");
1052
- if(lazybox) lazybox.classList.add("loaded");
1053
- if(lazybox) lazybox.classList.remove("loading");
1054
- };
1050
+ image.onload = function() {
1051
+ this.classList.add("loaded");
1052
+ this.classList.remove("loading");
1053
+ if(lazybox) lazybox.classList.add("loaded");
1054
+ if(lazybox) lazybox.classList.remove("loading");
1055
+ };
1055
1056
 
1056
- if(lazybox) lazybox.classList.add("loading");
1057
- image.classList.add("loading");
1058
- image.src = image.dataset.src;
1057
+ if(lazybox) lazybox.classList.add("loading");
1058
+ image.classList.add("loading");
1059
+ image.src = image.dataset.src;
1059
1060
 
1060
1061
  imageObserver.unobserve(image);
1061
1062
  }
1062
- });
1063
- });
1063
+ });
1064
+ }, options);
1064
1065
 
1065
1066
  lazyloadImages.forEach(function (image) {
1066
1067
  imageObserver.observe(image);