UNPKG

tiny-slider

Version:

Vanilla javascript slider for all purposes, inspired by Owl Carousel.

22 lines (17 loc) • 765 B
// create and append style sheet export function createStyleSheet (media, nonce) { // Create the <style> tag var style = document.createElement("style"); // style.setAttribute("type", "text/css"); // Add a media (and/or media query) here if you'd like! // style.setAttribute("media", "screen") // style.setAttribute("media", "only screen and (max-width : 1024px)") if (media) { style.setAttribute("media", media); } // Add nonce attribute for Content Security Policy if (nonce) { style.setAttribute("nonce", nonce); } // WebKit hack :( // style.appendChild(document.createTextNode("")); // Add the <style> element to the page document.querySelector('head').appendChild(style); return style.sheet ? style.sheet : style.styleSheet; };