Skip to main content

ESM with Bundle

This option is intended for use with modern frameworks like React, Vue or Svelte, or any project that supports ES modules. The CSS is automatically injected into the page at runtime, so you only need to import a single file.

Installation

npm install on-view-animations

Usage

Import initOVA and call it once the DOM is ready.

import { initOVA } from "on-view-animations";
import { useEffect } from "react";

export default function App() {
useEffect(() => {
initOVA();
}, []);

return (
<div data-ova="animation: fade-top; duration: 800ms">
<h1>Hello World</h1>
</div>
);
}
Direct Download

If you installed via direct download, replace the import path with './path/to/ova.bundle.esm.js'.

CSS auto-injected

With this bundle you do not need to import any CSS file separately — it is automatically injected at runtime.

HTML

Add the data-ova attribute to any element you want to animate:

<div data-ova>Animated element</div>