UNPKG

@lagrange/animator

Version:

This library helps making parallax animations on scroll. It is built with performance in mind, as it doesn't need to relayout or paint to operate.

19 lines (16 loc) 367 B
//@ts-check export function guid() { return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); } /** * @param {HTMLElement} element * @returns {string} */ export function elemGuid(element) { let id = element.getAttribute('data-guid'); if (!id) { id = guid(); element.setAttribute('data-guid', id); } return id; }