I have a custom module that does only one thing and that is lazy loading images. For the lazy loading part, I'm using jQuery Lazy (http://jquery.eisbehr.de/lazy/)
My Problem: Sometimes the jQuery Lazy loading library is loaded BEFORE jQuery which results in console errors.
Hereunder my code:
requirejs-config.js:
var config = {
map: {
'*': {
jqlazy: 'Fks_Custom/js/jquery.lazy.min',
}
},
shim: {
jqlazy: {
deps: ['jquery']
}
}
};
Template; lazyload.phtml:
<script>
require([
"jquery",
'jqlazy'
], function($) {
$(".lazy").Lazy({
enableThrottle: true,
throttle: 250
});
});
</script>
Is there something wrong?