My steps:
1) Load my file slider.js
to: app/design/frontend/Vendorname/default/web/js
.
2) Create requirejs-config.js
to: app/design/frontend/Vendorname/default
var config = {
paths: {
slider: "js/slider"
},
shim: {
slider: {
deps: ["jquery"]
}
}
};
3) rm -R pub/static/*
4) bin/magento setup:static-content:deploy
When I open site, slider.js
is not loaded.
I need to call him, that he began to load?
I read a lot of Magento 2: Javascript Init Scripts, Use custom JavaScript.
Realy need help.