UNPKG

react-carousel-query

Version:

A infinite carousel component made with react that handles the pagination for you.

28 lines (24 loc) 784 B
import global from 'global'; export const clearStyles = selector => { const selectors = Array.isArray(selector) ? selector : [selector]; selectors.forEach(clearStyle); }; const clearStyle = selector => { const element = global.document.getElementById(selector); if (element && element.parentElement) { element.parentElement.removeChild(element); } }; export const addOutlineStyles = (selector, css) => { const existingStyle = global.document.getElementById(selector); if (existingStyle) { if (existingStyle.innerHTML !== css) { existingStyle.innerHTML = css; } } else { const style = global.document.createElement('style'); style.setAttribute('id', selector); style.innerHTML = css; global.document.head.appendChild(style); } };