Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scrawlon/bc0c45c3cf58f0a90b6a78dbd9a20d8f to your computer and use it in GitHub Desktop.
Save scrawlon/bc0c45c3cf58f0a90b6a78dbd9a20d8f to your computer and use it in GitHub Desktop.
Swiper JS fullscreen image slider CSS
<style>
.swiper-container {
height: 300px;
}
.swiper-container.fullscreen {
height: 100vh;
}
.swiper-slide {
background: lightgray;
text-align: center;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.swiper-slide img {
position: absolute;
max-width: 100%;
z-index: 2;
cursor: pointer;
}
.swiper-slide figcaption {
position: absolute;
bottom: 15%;
z-index: 3;
}
.swiper-slide a {
background: #000;
color: #fff;
}
.fullscreen .swiper-slide img {
pointer-events: none;
}
.fullscreen .swiper-slide .backdrop {
background: #000;
opacity: .7;
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
z-index: 1;
cursor: pointer;
}
.fullscreen .swiper-slide .close-button {
background: #000;
color: #fff;
font-size: 16px;
font-family: sans-serif;
padding: 10px 18px;
position: absolute;
top: 0;
right: 0;
z-index: 4;
cursor: pointer;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment