23 lines
648 B
TypeScript
23 lines
648 B
TypeScript
export namespace DOMTools {
|
|
export const animate = (e: unknown, animationName: string) => {
|
|
if (e instanceof Event) {
|
|
e = e.target;
|
|
}
|
|
if (e instanceof HTMLElement) {
|
|
e.style.animationName = '';
|
|
e.style.animationName = animationName;
|
|
}
|
|
}
|
|
|
|
export const scrollDown = (e: unknown, smooth?: any) => {
|
|
if (e instanceof Event) {
|
|
e = e.target;
|
|
}
|
|
if (e instanceof HTMLElement) {
|
|
e.scrollTo({
|
|
top: e.scrollHeight,
|
|
behavior: smooth !== false ? 'smooth' : 'instant',
|
|
});
|
|
}
|
|
}
|
|
} |