drab
Version:
Interactivity for You
29 lines (28 loc) • 963 B
TypeScript
import { Base, type BaseAttributes } from "../base/index.js";
export type IntersectAttributes = BaseAttributes & {
threshold?: number;
};
type IntersectCallback = () => any;
/**
* Uses the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) to add a `data-intersect` attribute to `content` when the `trigger` is intersecting.
*
* Use `onIntersect` and `onExit` to customize further with JavaScript.
*
* `threshold`
*
* Specify a `threshold` between `0` and `1` to determine how much of the `trigger` should be visible for the intersection to occur.
*/
export declare class Intersect extends Base {
#private;
constructor();
/**
* @param callback Runs when `trigger` intersects.
*/
onIntersect(callback: IntersectCallback): void;
/**
* @param callback Runs when `trigger` exits.
*/
onExit(callback: IntersectCallback): void;
mount(): void;
}
export {};