Currently I am working in magento2 theme part. And I have a main.js
file which I have added via default_head_blocks.xml
. But its having jquery conflict
. I removed jquery conflict using noConflict
. When I do this my testimonial section which consists of owl carousel doesnt work. Please tell me how to add my 'main.js'
file.
or
Can someone tell me how to include the functions in 'main.js'
on header to display the banner and drop-down menu?
Best Answer
Try this:
Update your
require-config.js
file this content:Then You need to call that files in your
PHTML
:And
main.js
content should be like this:If your file in theme then file should be in
app/design/frontend/{{theme package name}}/{{theme name}}/{{Module package name}}_{{module name}}/web/js/main.js
AND If your file in module then file should be inapp/code/{{Module package name}}/{{module name}}/view/frontend/web/js/main.js
.