Vanilla JS
This is the simplest way to use OVA. Download a single file, include it in your HTML, and you're done — no build tools or configuration required.
Installation
- CDN
- npm
- Direct Download
Include OVA directly in your HTML — no download or build step required.
jsDelivr:
<script
src="https://cdn.jsdelivr.net/npm/on-view-animations/dist/ova.bundle.min.js"
data-auto-init
></script>
unpkg:
<script
src="https://unpkg.com/on-view-animations/dist/ova.bundle.min.js"
data-auto-init
></script>
npm install on-view-animations
Then reference the bundle from your node_modules:
<script
src="node_modules/on-view-animations/dist/ova.bundle.min.js"
data-auto-init
></script>
Download ova.bundle.min.js — includes both JavaScript and CSS in a single file.
Usage
Add the script tag to your HTML file with the data-auto-init attribute. OVA will initialize itself automatically when the DOM is ready — no JavaScript required on your end.
- CDN
- npm
- Direct Download
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Page</title>
</head>
<body>
<div data-ova="">
<h1>Hello World</h1>
</div>
<!-- Load OVA at the end of the body -->
<script
src="https://cdn.jsdelivr.net/npm/on-view-animations/dist/ova.bundle.min.js"
data-auto-init
></script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Page</title>
</head>
<body>
<div data-ova="">
<h1>Hello World</h1>
</div>
<!-- Load OVA at the end of the body -->
<script
src="node_modules/on-view-animations/dist/ova.bundle.min.js"
data-auto-init
></script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Page</title>
</head>
<body>
<div data-ova="">
<h1>Hello World</h1>
</div>
<!-- Load OVA at the end of the body -->
<script src="ova.bundle.min.js" data-auto-init></script>
</body>
</html>
Place the <script> tag at the end of <body> to ensure the DOM is fully loaded before OVA runs.
Manual initialization
If you need more control over when OVA initializes — for example, after dynamically injecting content into the DOM — you can omit data-auto-init and call initOVA() manually:
- CDN
- npm
- Direct Download
<script src="https://cdn.jsdelivr.net/npm/on-view-animations/dist/ova.bundle.min.js"></script>
<script>
window.initOVA();
</script>
<script src="node_modules/on-view-animations/dist/ova.bundle.min.js"></script>
<script>
window.initOVA();
</script>
<script src="path/to/ova.bundle.min.js"></script>
<script>
window.initOVA();
</script>
Make sure to call initOVA() only after the DOM is fully loaded. If your script is in the <head>, wrap the call in a DOMContentLoaded listener:
document.addEventListener("DOMContentLoaded", () => window.initOVA());