lazyload
lazyload copied to clipboard
Lazyload breaks the website on Safari for Windows
Hello everybody,
Lazyload works very-well on all browsers! However, only on Safari for Windows I noticed, this error and my page doens't load at all!
SyntaxError: Unexpected token 'const' jquery.min.js:2 jQuery.Deferred exception: 'undefined' is not a function (evaluating '$(".lazyload").lazyload()') undefined undefined custom.js:4TypeError: 'undefined' is not a function (evaluating '$(".lazyload").lazyload()')
Why this happens?
Yes I too face same issue , could anyone find the reason, please.
In your case the problem seems to be that your browser doesn't support JavaScript ES6 syntax. ("Unexpected token 'const'")
This might be the reason, too: https://caniuse.com/#feat=intersectionobserver Safari doesn't support the IntersectionObserver API.
Try using the v1 version: https://appelsiini.net/projects/lazyload/v1/
Polyfills can be used to add missing features to old browsers.
https://github.com/w3c/IntersectionObserver
However development of Safari for Windows has been stopped several years ago. I think the Windows version is 5.x which is from year 2011 so I doubt it is able to run this library. Converting to old JavaScript syntax with Babel might help, but easier might be just disable lazyload with Windows Safari.
Version 2.0.0-beta.2 I've replaced 3 occurencies of const by var. Works now on Safari 7, 8, 9, 10 on Mac OS 10.09 to 10.11 and still working on Firefox, Chrome and IE Edge and 10.
I tried that change, but it broke the plugin on Chrome v69