In requirejs-config.js I have defined the owlcarousel path like below. But still the error Uncaught TypeError: $(...).owlCarousel is not a function(…)
does not let product slider in home page work? I have deployed the content and cleared the cache as well.
var config = {
paths: {
'owlcarousel': "web/owl.carousel/owl.carousel.js"
},
shim: {
'owlcarousel': {
deps: ['jquery']
}
}
};
Best Answer
Firstly you need to put your js in app/code/vendor/module/frontend/web/js
Secondly you need to put your requirejs-config.js in app/code/vendor/module/frontend
You dont need to mention .js extension at last.
Also you need to write Vendor_Modulename while calling js in requirejs-config.js
Just pass file name only.
Try below code :
put this in your owlcarousal.js top and close it at last -
After that run setup:di:compile command and check.