UNPKG

@dboehmeiii/image-carousel

Version:
110 lines (94 loc) 1.73 kB
* { padding: 0; margin: 0; box-sizing: border-box; user-select: none; } body { width: 100vw; height: 100vh; background-color: var(--bg-color); display: flex; justify-content: center; align-items: center; } .image-carousel-container { position: relative; width: 35%; box-shadow: 5px 10px 20px 1px rgba(0, 0, 0, 0.3); } .image-carousel-frame { overflow: hidden; border-radius: 3px; } .image-carousel-slides { display: flex; } .image-carousel-slides img { width: 100%; object-fit: cover; display: block; } .image-carousel-next, .image-carousel-previous { position: absolute; top: 50%; transform: translateY(-50%); width: 2rem; height: auto; z-index: 10; } .image-carousel-next { right: 3%; } .image-carousel-previous { left: 3%; } .image-carousel-nav-dot-container { display: flex; justify-content: space-around; align-items: center; height: 10%; width: 30%; top: 90%; left: 35%; position: absolute; z-index: 5; transition: transform 0.3s ease; } .image-carousel-svg-container { width: 1.5rem; height: 1.5rem; display: flex; justify-content: center; align-items: center; } .image-carousel-dots-svg { width: 100%; height: 100%; } .image-carousel-dots-svg circle { fill: rgba(255, 255, 255, 0.5); stroke: rgba(45, 45, 45, 0.9); transition: stroke-width 0.3s ease; } .image-carousel-svg-container.active .image-carousel-dots-svg circle { fill: rgba(45, 45, 45, 0.5); stroke: rgba(205, 205, 205, 0.9); } @keyframes next { 0% { transform: translateX(0%); } 100% { transform: translateX(-100%); } } @keyframes previous { 0% { transform: translateX(0%); } 100% { transform: translateX(100%); } }