web-scripting / Digital Marketing Website Draft / aos-master / src / js / helpers / elements.js
elements.js
Raw
/**
 * Generate initial array with elements as objects
 * This array will be extended later with elements attributes values
 * like 'position'
 */
const createArrayWithElements = function (elements) {
  elements = elements || document.querySelectorAll('[data-aos]');
  return Array.prototype.map.call(elements, node => ({ node }));
};

export default createArrayWithElements;