Created
November 18, 2023 20:36
-
-
Save RoryCombe/b4658302b1727c87c757ea16e9ea8b48 to your computer and use it in GitHub Desktop.
Pico Slider Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Pico Slider Test</title> | |
</head> | |
<body> | |
<script src="https://unpkg.com/pico-slider/dist/index.js" type="module" async defer></script> | |
<script type="module"> | |
const characters = await fetch('https://rickandmortyapi.com/api/character').then((res) => res.json()); | |
const elem = document.createElement('pico-slider'); | |
elem.setAttribute('selected-index', 1); | |
elem.innerHTML = characters.results.map((c) => `<img src="${c.image}" />`).join(''); | |
document.body.append(elem); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment