Using jquery_lazyload on Magento 2How to using instafeed in magento 2 with requirejs?Magento 2.0.7 After page...
What is better: yes / no radio, or simple checkbox?
What can I do if someone tampers with my SSH public key?
How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?
Too soon for a plot twist?
Boss Telling direct supervisor I snitched
Did Amazon pay $0 in taxes last year?
How can I wire a Raspberry Pi to an 8-relay board in a tidy professional manner?
Is it possible to clone a polymorphic object without manually adding overridden clone method into each derived class in C++?
Which country has more?
Is "cogitate" used appropriately in "I cogitate that success relies on hard work"?
Is there a logarithm base for which the logarithm becomes an identity function?
Cycles on the torus
What does *dead* mean in *What do you mean, dead?*?
Either of .... (Plural/Singular)
Optimal Proportions for Flying Humans
What do you call someone who likes to pick fights?
Writing text next to a table
-1 to the power of a irrational number
How do we create new idioms and use them in a novel?
Was it really inappropriate to write a pull request for the company I interviewed with?
Has a sovereign Communist government ever run, and conceded loss, on a fair election?
Are E natural minor and B harmonic minor related?
Can I negotiate a patent idea for a raise, under French law?
Yet another question on sums of the reciprocals of the primes
Using jquery_lazyload on Magento 2
How to using instafeed in magento 2 with requirejs?Magento 2.0.7 After page refresh some js giving error?intermittent jQuery not defined issue when using cycle2 carouselHow to using mixins for “mage/dataPost”?Magento 2 lazy load for product price and add to cart buttonHow to crop square images in Magento 2 using view.xmlusing javascript in .html form Magento2How to use third party jquery libraries in magento along with requirejs?Magento 2 Integrate Lazy Load without using any third party extensionjquery plugin error “Uncaught TypeError: $(…).[plugin function] is not a function”
I tried to use jquery_lazyload on Magento 2 & cant't get it to work.
I loaded it using requirejs-config.js
var config = {
deps: [
"js/my_script"
],
paths: {
"LazyLoad": "//cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload"
},
shim: {
'LazyLoad': {
deps: ['jquery']
}
}
};
& then I added my_script.js
define(["jquery","LazyLoad"], function($) {
"use strict";
$(document).ready(function($) {
let images = document.querySelectorAll(".lazyload");
lazyload(images);
});
return;
});
What I get is this error on console:
lazyload.js:78 Uncaught TypeError: Cannot set property 'settings' of undefined
at LazyLoad (lazyload.js:78)
at Object.execCb (require.js:1650)
at Module.check (require.js:866)
at Module.enable (require.js:1143)
at Module.init (require.js:774)
at callGetModule (require.js:1170)
at Object.completeLoad (require.js:1544)
at HTMLScriptElement.onScriptLoad (require.js:1671)
Update: The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
UPDATE (solved)
It's working fine with older version of lazyload (1.9.3), I got the error on v2.0.0. Still have no idea why it failed with the newer version though.
magento2.2 requirejs lazyload
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I tried to use jquery_lazyload on Magento 2 & cant't get it to work.
I loaded it using requirejs-config.js
var config = {
deps: [
"js/my_script"
],
paths: {
"LazyLoad": "//cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload"
},
shim: {
'LazyLoad': {
deps: ['jquery']
}
}
};
& then I added my_script.js
define(["jquery","LazyLoad"], function($) {
"use strict";
$(document).ready(function($) {
let images = document.querySelectorAll(".lazyload");
lazyload(images);
});
return;
});
What I get is this error on console:
lazyload.js:78 Uncaught TypeError: Cannot set property 'settings' of undefined
at LazyLoad (lazyload.js:78)
at Object.execCb (require.js:1650)
at Module.check (require.js:866)
at Module.enable (require.js:1143)
at Module.init (require.js:774)
at callGetModule (require.js:1170)
at Object.completeLoad (require.js:1544)
at HTMLScriptElement.onScriptLoad (require.js:1671)
Update: The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
UPDATE (solved)
It's working fine with older version of lazyload (1.9.3), I got the error on v2.0.0. Still have no idea why it failed with the newer version though.
magento2.2 requirejs lazyload
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Try to call likenew LazyLoad(images);instead oflayzyload(images)
– Rajeev K Tomy
Mar 8 '18 at 12:47
add a comment |
I tried to use jquery_lazyload on Magento 2 & cant't get it to work.
I loaded it using requirejs-config.js
var config = {
deps: [
"js/my_script"
],
paths: {
"LazyLoad": "//cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload"
},
shim: {
'LazyLoad': {
deps: ['jquery']
}
}
};
& then I added my_script.js
define(["jquery","LazyLoad"], function($) {
"use strict";
$(document).ready(function($) {
let images = document.querySelectorAll(".lazyload");
lazyload(images);
});
return;
});
What I get is this error on console:
lazyload.js:78 Uncaught TypeError: Cannot set property 'settings' of undefined
at LazyLoad (lazyload.js:78)
at Object.execCb (require.js:1650)
at Module.check (require.js:866)
at Module.enable (require.js:1143)
at Module.init (require.js:774)
at callGetModule (require.js:1170)
at Object.completeLoad (require.js:1544)
at HTMLScriptElement.onScriptLoad (require.js:1671)
Update: The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
UPDATE (solved)
It's working fine with older version of lazyload (1.9.3), I got the error on v2.0.0. Still have no idea why it failed with the newer version though.
magento2.2 requirejs lazyload
I tried to use jquery_lazyload on Magento 2 & cant't get it to work.
I loaded it using requirejs-config.js
var config = {
deps: [
"js/my_script"
],
paths: {
"LazyLoad": "//cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload"
},
shim: {
'LazyLoad': {
deps: ['jquery']
}
}
};
& then I added my_script.js
define(["jquery","LazyLoad"], function($) {
"use strict";
$(document).ready(function($) {
let images = document.querySelectorAll(".lazyload");
lazyload(images);
});
return;
});
What I get is this error on console:
lazyload.js:78 Uncaught TypeError: Cannot set property 'settings' of undefined
at LazyLoad (lazyload.js:78)
at Object.execCb (require.js:1650)
at Module.check (require.js:866)
at Module.enable (require.js:1143)
at Module.init (require.js:774)
at callGetModule (require.js:1170)
at Object.completeLoad (require.js:1544)
at HTMLScriptElement.onScriptLoad (require.js:1671)
Update: The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
UPDATE (solved)
It's working fine with older version of lazyload (1.9.3), I got the error on v2.0.0. Still have no idea why it failed with the newer version though.
magento2.2 requirejs lazyload
magento2.2 requirejs lazyload
edited Mar 8 '18 at 13:31
Pini
asked Mar 8 '18 at 11:31
PiniPini
385213
385213
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Try to call likenew LazyLoad(images);instead oflayzyload(images)
– Rajeev K Tomy
Mar 8 '18 at 12:47
add a comment |
Try to call likenew LazyLoad(images);instead oflayzyload(images)
– Rajeev K Tomy
Mar 8 '18 at 12:47
Try to call like
new LazyLoad(images); instead of layzyload(images)– Rajeev K Tomy
Mar 8 '18 at 12:47
Try to call like
new LazyLoad(images); instead of layzyload(images)– Rajeev K Tomy
Mar 8 '18 at 12:47
add a comment |
2 Answers
2
active
oldest
votes
Try this
app/code/Ravindra/Modulename/view/frontend/requirejs-config.js
var config = {
paths: {
'lazyloadjs': 'Ravindra_Modulename/js/lazyload.js'
},
shim: {
'lazyloadjs': {
deps: ['jquery']
}
}
};
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
add a comment |
requirejs-config.js
var config = {
paths: {
'lazyload': "Vendor_Modulename/js/myfile"
},
shim: {
'lazyload': {
deps: ['jquery']
}
}
}
You can use anywhere in your template file by below method
<srcipt>
require(["jquery","lazyload"],function($,myfile){
$(document).ready(function(){
//call your js here...
})
})
</script>
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f216565%2fusing-jquery-lazyload-on-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this
app/code/Ravindra/Modulename/view/frontend/requirejs-config.js
var config = {
paths: {
'lazyloadjs': 'Ravindra_Modulename/js/lazyload.js'
},
shim: {
'lazyloadjs': {
deps: ['jquery']
}
}
};
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
add a comment |
Try this
app/code/Ravindra/Modulename/view/frontend/requirejs-config.js
var config = {
paths: {
'lazyloadjs': 'Ravindra_Modulename/js/lazyload.js'
},
shim: {
'lazyloadjs': {
deps: ['jquery']
}
}
};
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
add a comment |
Try this
app/code/Ravindra/Modulename/view/frontend/requirejs-config.js
var config = {
paths: {
'lazyloadjs': 'Ravindra_Modulename/js/lazyload.js'
},
shim: {
'lazyloadjs': {
deps: ['jquery']
}
}
};
Try this
app/code/Ravindra/Modulename/view/frontend/requirejs-config.js
var config = {
paths: {
'lazyloadjs': 'Ravindra_Modulename/js/lazyload.js'
},
shim: {
'lazyloadjs': {
deps: ['jquery']
}
}
};
answered Mar 8 '18 at 11:35
Ravindrasinh ZalaRavindrasinh Zala
1,261322
1,261322
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
add a comment |
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:02
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
php bin/magento setup:static-content:deploy -f
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* var/generation/* var/page_cache/* var/view_preprocessed/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
rm -rf var/cache/* generated/*
– Ravindrasinh Zala
Mar 8 '18 at 12:11
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
The error occures even when I'm not initializing the lazyload (something in the file itself breaks the requirejs).
– Pini
Mar 8 '18 at 13:18
add a comment |
requirejs-config.js
var config = {
paths: {
'lazyload': "Vendor_Modulename/js/myfile"
},
shim: {
'lazyload': {
deps: ['jquery']
}
}
}
You can use anywhere in your template file by below method
<srcipt>
require(["jquery","lazyload"],function($,myfile){
$(document).ready(function(){
//call your js here...
})
})
</script>
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
add a comment |
requirejs-config.js
var config = {
paths: {
'lazyload': "Vendor_Modulename/js/myfile"
},
shim: {
'lazyload': {
deps: ['jquery']
}
}
}
You can use anywhere in your template file by below method
<srcipt>
require(["jquery","lazyload"],function($,myfile){
$(document).ready(function(){
//call your js here...
})
})
</script>
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
add a comment |
requirejs-config.js
var config = {
paths: {
'lazyload': "Vendor_Modulename/js/myfile"
},
shim: {
'lazyload': {
deps: ['jquery']
}
}
}
You can use anywhere in your template file by below method
<srcipt>
require(["jquery","lazyload"],function($,myfile){
$(document).ready(function(){
//call your js here...
})
})
</script>
requirejs-config.js
var config = {
paths: {
'lazyload': "Vendor_Modulename/js/myfile"
},
shim: {
'lazyload': {
deps: ['jquery']
}
}
}
You can use anywhere in your template file by below method
<srcipt>
require(["jquery","lazyload"],function($,myfile){
$(document).ready(function(){
//call your js here...
})
})
</script>
answered Mar 8 '18 at 11:40
Kishan PatadiaKishan Patadia
3,7891924
3,7891924
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
add a comment |
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
Tried that & got the same error.
– Pini
Mar 8 '18 at 12:01
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f216565%2fusing-jquery-lazyload-on-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try to call like
new LazyLoad(images);instead oflayzyload(images)– Rajeev K Tomy
Mar 8 '18 at 12:47