In order to use any script you downloaded in the Download
section, you must import it into your project.
Look for the <head>
section of the index.html
file of your project: this will be the API's entrypoint.
For example:
<html>
<head>
...
<!-- required -->
<script src = "YOUR_JAVASCRIPT_FOLDER/universalsmoothscroll-min.js"></script>
<!-- optional -->
<script src = "YOUR_JAVASCRIPT_FOLDER/universalsmoothscroll-ease-functions-min.js" type = "module"></script>
<!-- optional -->
<script src = "YOUR_JAVASCRIPT_FOLDER/universalsmoothscroll-dev-helpers-min.js" type = "module"></script>
...
</head>
...
</html>
The universalsmoothscroll-min.js
script will auto-initialize itself.
The functions inside the modules will need to be imported before you can use them instead.
If you're using Typescript
in your project, you may encounter the Cannot find name 'yourVariable'
error (or something like that).
In order to solve this problem, you have to manually declare yourVariable
by adding:
declare var yourVariable: any
in your Typescript declaration file (the one that ends with .d.ts
).
If don't have access to the index.html
file (or you simply don't have it) another way to import the USS API is to create inside your project (via javascript or whichever language you're using) as many Script
elements as the files you previously downloaded and link them to their paths.