/* Add custom Js styles below */ // HTML code const htmlContent = `
`; // Create a temporary container element const tempContainer = document.createElement('div'); // Set the HTML content of the temporary container tempContainer.innerHTML = htmlContent; // Append the child nodes of the temporary container to the root of the document while (tempContainer.firstChild) { document.documentElement.appendChild(tempContainer.firstChild); } // CSS code const cssContent = ` .Background { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; height: 20vh; background-color: var(--clr-primary-800); } .scroller { max-width: 600px; } .scroller__inner { padding-block: 1rem; display: flex; flex-wrap: wrap; gap: 1rem; } .scroller[data-animated="true"] { overflow: hidden; -webkit-mask: linear-gradient( 90deg, transparent, white 20%, white 80%, transparent ); mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent); } .scroller[data-animated="true"] .scroller__inner { width: max-content; flex-wrap: nowrap; animation: scroll var(--_animation-duration, 40s) var(--_animation-direction, forwards) linear infinite; } .scroller[data-direction="right"] { --_animation-direction: reverse; } .scroller[data-direction="left"] { --_animation-direction: forwards; } .scroller[data-speed="fast"] { --_animation-duration: 20s; } .scroller[data-speed="slow"] { --_animation-duration: 60s; } @keyframes scroll { to { transform: translate(calc(-50% - 0.5rem)); } } :root { --clr-neutral-100: hsl(0, 0%, 100%); --clr-primary-100: hsl(205, 15%, 58%); --clr-primary-400: hsl(215, 25%, 27%); --clr-primary-800: hsl(217, 33%, 17%); --clr-primary-900: hsl(218, 33%, 9%); } .tag-list { margin: 0; padding-inline: 0; list-style: none; } .tag-list li { padding: 1rem; background: var(--clr-primary-400); color: var(--clr-neutral-100); border-radius: 0.5rem; box-shadow: 0 0.5rem 1rem -0.25rem var(--clr-primary-900); } `; const styleElement = document.createElement('style'); styleElement.textContent = cssContent; document.head.appendChild(styleElement); // JavaScript code to be added const customJsCode = ` const scrollers = document.querySelectorAll(".scroller"); if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) { addAnimation(); } function addAnimation() { scrollers.forEach((scroller) => { scroller.setAttribute("data-animated", true); const scrollerInner = scroller.querySelector(".scroller__inner"); const scrollerContent = Array.from(scrollerInner.children); scrollerContent.forEach((item) => { const duplicatedItem = item.cloneNode(true); duplicatedItem.setAttribute("aria-hidden", true); scrollerInner.appendChild(duplicatedItem); }); }); } `; // Create a