support for Edge + IE11

parent f264bc31
......@@ -134,7 +134,7 @@
if (!this.settings) { return; }
var self = this;
this.images.forEach(function (image) {
Array.prototype.forEach.call(this.images, function (image) {
var src = image.getAttribute(self.settings.src);
var srcset = image.getAttribute(self.settings.srcset);
if ("img" === image.tagName.toLowerCase()) {
......
(function(root,factory){if(typeof exports==="object"){module.exports=factory(root)}else if(typeof define==="function"&&define.amd){define([],factory(root))}else{root.LazyLoad=factory(root)}})(typeof global!=="undefined"?global:this.window||this.global,function(root){"use strict";var defaults={src:"data-src",srcset:"data-srcset",selector:".lazyload"};var extend=function(){var extended={};var deep=false;var i=0;var length=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){deep=arguments[0];i+=1}var merge=function(obj){for(var prop in obj){if(Object.prototype.hasOwnProperty.call(obj,prop)){if(deep&&Object.prototype.toString.call(obj[prop])==="[object Object]"){extended[prop]=extend(true,extended[prop],obj[prop])}else{extended[prop]=obj[prop]}}}};for(;i<length;i+=1){var obj=arguments[i];merge(obj)}return extended};function LazyLoad(images,options){this.settings=extend(defaults,options||{});this.images=images||document.querySelectorAll(this.settings.selector);this.observer=null;this.init()}LazyLoad.prototype={init:function(){if(!root.IntersectionObserver){this.loadImages();return}var self=this;var observerConfig={root:null,rootMargin:"0px",threshold:[0]};this.observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){if(entry.intersectionRatio>0){self.observer.unobserve(entry.target);var src=entry.target.getAttribute(self.settings.src);var srcset=entry.target.getAttribute(self.settings.srcset);if("img"===entry.target.tagName.toLowerCase()){if(src){entry.target.src=src}if(srcset){entry.target.srcset=srcset}}else{entry.target.style.backgroundImage="url("+src+")"}}})},observerConfig);this.images.forEach(function(image){self.observer.observe(image)})},loadAndDestroy:function(){if(!this.settings){return}this.loadImages();this.destroy()},loadImages:function(){if(!this.settings){return}var self=this;this.images.forEach(function(image){var src=image.getAttribute(self.settings.src);var srcset=image.getAttribute(self.settings.srcset);if("img"===image.tagName.toLowerCase()){if(src){image.src=src}if(srcset){image.srcset=srcset}}else{image.style.backgroundImage="url("+src+")"}})},destroy:function(){if(!this.settings){return}this.observer.disconnect();this.settings=null}};root.lazyload=function(images,options){return new LazyLoad(images,options)};if(root.jQuery){var $=root.jQuery;$.fn.lazyload=function(options){options=options||{};options.attribute=options.attribute||"data-src";new LazyLoad($.makeArray(this),options);return this}}return LazyLoad});
\ No newline at end of file
(function(root,factory){if(typeof exports==="object"){module.exports=factory(root)}else if(typeof define==="function"&&define.amd){define([],factory(root))}else{root.LazyLoad=factory(root)}})(typeof global!=="undefined"?global:this.window||this.global,function(root){"use strict";var defaults={src:"data-src",srcset:"data-srcset",selector:".lazyload"};var extend=function(){var extended={};var deep=false;var i=0;var length=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){deep=arguments[0];i+=1}var merge=function(obj){for(var prop in obj){if(Object.prototype.hasOwnProperty.call(obj,prop)){if(deep&&Object.prototype.toString.call(obj[prop])==="[object Object]"){extended[prop]=extend(true,extended[prop],obj[prop])}else{extended[prop]=obj[prop]}}}};for(;i<length;i+=1){var obj=arguments[i];merge(obj)}return extended};function LazyLoad(images,options){this.settings=extend(defaults,options||{});this.images=images||document.querySelectorAll(this.settings.selector);this.observer=null;this.init()}LazyLoad.prototype={init:function(){if(!root.IntersectionObserver){this.loadImages();return}var self=this;var observerConfig={root:null,rootMargin:"0px",threshold:[0]};this.observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){if(entry.intersectionRatio>0){self.observer.unobserve(entry.target);var src=entry.target.getAttribute(self.settings.src);var srcset=entry.target.getAttribute(self.settings.srcset);if("img"===entry.target.tagName.toLowerCase()){if(src){entry.target.src=src}if(srcset){entry.target.srcset=srcset}}else{entry.target.style.backgroundImage="url("+src+")"}}})},observerConfig);this.images.forEach(function(image){self.observer.observe(image)})},loadAndDestroy:function(){if(!this.settings){return}this.loadImages();this.destroy()},loadImages:function(){if(!this.settings){return}var self=this;Array.prototype.forEach.call(this.images,function(image){var src=image.getAttribute(self.settings.src);var srcset=image.getAttribute(self.settings.srcset);if("img"===image.tagName.toLowerCase()){if(src){image.src=src}if(srcset){image.srcset=srcset}}else{image.style.backgroundImage="url("+src+")"}})},destroy:function(){if(!this.settings){return}this.observer.disconnect();this.settings=null}};root.lazyload=function(images,options){return new LazyLoad(images,options)};if(root.jQuery){var $=root.jQuery;$.fn.lazyload=function(options){options=options||{};options.attribute=options.attribute||"data-src";new LazyLoad($.makeArray(this),options);return this}}return LazyLoad});
\ No newline at end of file
......@@ -17,6 +17,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/overrides.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/leaflet.fullscreen.css' %}">
{% endcompress %}
{% if debug %}
<script type="text/javascript" src="{% static 'js/vue.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery-3.2.1.js' %}"></script>
......
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