A Pen by Dave DeSandro on CodePen.
Created
April 16, 2022 14:34
-
-
Save 1903-development-team/ea6db6746dd10744274cd3584b906f70 to your computer and use it in GitHub Desktop.
Flickity - asNavFor
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
<h1>Flickity - asNavFor</h1> | |
<!-- Flickity HTML init --> | |
<div class="carousel carousel-main" data-flickity> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
</div> | |
<div class="carousel carousel-nav" | |
data-flickity='{ "asNavFor": ".carousel-main", "contain": true, "pageDots": false }'> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
<div class="carousel-cell"></div> | |
</div> |
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
// external js: flickity.pkgd.js |
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
<script src="https://npmcdn.com/flickity@2/dist/flickity.pkgd.js"></script> |
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
/* external css: flickity.css */ | |
* { box-sizing: border-box; } | |
body { font-family: sans-serif; } | |
.carousel { | |
background: #FAFAFA; | |
margin-bottom: 40px; | |
} | |
.carousel-cell { | |
width: 100%; | |
height: 200px; | |
margin-right: 10px; | |
background: #8C8; | |
border-radius: 5px; | |
counter-increment: carousel-cell; | |
} | |
/* cell number */ | |
.carousel-cell:before { | |
display: block; | |
text-align: center; | |
content: counter(carousel-cell); | |
line-height: 200px; | |
font-size: 80px; | |
color: white; | |
} | |
.carousel-nav .carousel-cell { | |
height: 80px; | |
width: 100px; | |
} | |
.carousel-nav .carousel-cell:before { | |
font-size: 50px; | |
line-height: 80px; | |
} | |
.carousel-nav .carousel-cell.is-nav-selected { | |
background: #ED2; | |
} |
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
<link href="https://npmcdn.com/flickity@2/dist/flickity.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment