I'm struggling trying to add this js library AOS
This is what I've tried to add both, css and js:
in Theme/Magento_Theme/layout/cms_index_index.xml i have this code:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/bootstrap.css" />
<css src="https://unpkg.com/[email protected]/dist/aos.css" src_type="url" />
</head>
</page>
The reason of why i'm using cms_index_index.xml instead of default_head_blocks.xml is because I want the library just be available in the home page.
Now for javascript I have this: Theme/Magento_Theme/requirejs-config.js
var config = {
paths: {
'bootstrap':'Magento_Theme/js/bootstrap.bundle',
'aos':"https://unpkg.com/[email protected]/dist/aos"
} ,
shim: {
'bootstrap': {
'deps': ['jquery']
},
'aos': {
'deps': ['jquery']
},
}
};
Bootstrap is working fine by the way.
Finally in Theme/Magento_Theme/templates/html/header.phtml i have this code:
<script type="text/javascript">require(['bootstrap','aos']);</script>
I practically did the same as I did for bootstrap, because bootstrap is working fine, but I don't know why AOS is not working. It should work just by adding classes like bootstrap.
Thanks and greetings!