Created
October 16, 2017 02:01
-
-
Save obaid/cdcd5bcf5edfb5c82e12fab90c389bdd to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/tajaqurofo
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://code.jquery.com/jquery.min.js"></script> | |
<link href="https://npmcdn.com/flickity@2/dist/flickity.css" rel="stylesheet" type="text/css" /> | |
<script src="https://npmcdn.com/flickity@2/dist/flickity.pkgd.js"></script> | |
<style id="jsbin-css"> | |
/* external css: flickity.css */ | |
* { box-sizing: border-box; } | |
body { font-family: sans-serif; } | |
.carousel { | |
/* background: #EEE; */ | |
width: 280px; | |
} | |
.carousel-cell { | |
width: 66%; | |
/* height: 200px; */ | |
margin-right: 5px; | |
/* background: #8C8; */ | |
background: white; | |
border-radius: 0px; | |
counter-increment: gallery-cell; | |
border: 1px solid #97A2A8; | |
border-bottom-width: 0px; | |
} | |
.carousel-cell img.header { | |
width: 100%; | |
} | |
.carousel-cell div.heading { | |
} | |
.carousel-cell div.buttons { | |
text-align: center; | |
} | |
.carousel-cell div.buttons .button { | |
background: white; | |
padding: 5px 0px; | |
border-top: 1px solid #1683FB; | |
border-bottom: 1px solid #1683FB; | |
} | |
.carousel-cell div.buttons .button:first-child { | |
border-bottom-width: 0px; | |
} | |
.carousel-cell div.buttons .button:last-child { | |
border-top-width: 0px; | |
} | |
.carousel-cell:last-child { | |
border-radius: 0px 15px 15px 0px; | |
} | |
.carousel-cell:first-child { | |
border-radius: 15px 0px 0px 15px; | |
} | |
.carousel-cell:first-child > *:first-child { | |
border-radius: 15px 0px 0px 0px; | |
} | |
.carousel-cell:first-child .button:last-child { | |
border-radius: 0px 0px 0px 14px; | |
} | |
.carousel-cell:last-child > *:first-child { | |
border-radius: 0px 15px 0px 0px; | |
} | |
.carousel-cell:last-child .button:last-child { | |
border-radius: 0px 0px 15px 0px; | |
} | |
/* cell number */ | |
.carousel-cell2:before { | |
display: block; | |
text-align: center; | |
content: counter(gallery-cell); | |
line-height: 200px; | |
font-size: 80px; | |
color: white; | |
} | |
</style> | |
</head> | |
<body> | |
<!-- Flickity HTML init --> | |
<div class="carousel"> | |
<div class="carousel-cell"> | |
<img src="http://placehold.it/300x150" class="header"/> | |
<div class="heading">This is my header</div> | |
<div class="buttons"> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
</div> | |
</div> | |
<div class="carousel-cell"> | |
<img src="http://placehold.it/300x150" class="header"/> | |
<div class="heading">This is my header</div> | |
<div class="buttons"> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
</div> | |
</div> | |
<div class="carousel-cell"> | |
<img src="http://placehold.it/300x150" class="header"/> | |
<div class="heading">This is my header</div> | |
<div class="buttons"> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
</div> | |
</div> | |
<div class="carousel-cell" data-selected="true"> | |
<img src="http://placehold.it/300x150" class="header"/> | |
<div class="heading">This is my header</div> | |
<div class="buttons"> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
<div class="button">Button Text</div> | |
</div> | |
</div> | |
</div> | |
<script id="jsbin-javascript"> | |
// external js: flickity.pkgd.js | |
var items = $(".carousel-cell"); | |
var c = $('.carousel').flickity({ | |
freeScroll: false, | |
pageDots: false, | |
prevNextButtons: false | |
}); | |
function scroll(to) { | |
c.flickity( 'select', to++ ); | |
//console.log(items[to]); | |
if (to < items.length) { | |
setTimeout(function() { | |
scroll(to++); | |
}, 1000); | |
} | |
} | |
scroll(0); | |
// alert(items.length); | |
</script> | |
<script id="jsbin-source-css" type="text/css">/* external css: flickity.css */ | |
* { box-sizing: border-box; } | |
body { font-family: sans-serif; } | |
.carousel { | |
/* background: #EEE; */ | |
width: 280px; | |
} | |
.carousel-cell { | |
width: 66%; | |
/* height: 200px; */ | |
margin-right: 5px; | |
/* background: #8C8; */ | |
background: white; | |
border-radius: 0px; | |
counter-increment: gallery-cell; | |
border: 1px solid #97A2A8; | |
border-bottom-width: 0px; | |
} | |
.carousel-cell img.header { | |
width: 100%; | |
} | |
.carousel-cell div.heading { | |
} | |
.carousel-cell div.buttons { | |
text-align: center; | |
} | |
.carousel-cell div.buttons .button { | |
background: white; | |
padding: 5px 0px; | |
border-top: 1px solid #1683FB; | |
border-bottom: 1px solid #1683FB; | |
} | |
.carousel-cell div.buttons .button:first-child { | |
border-bottom-width: 0px; | |
} | |
.carousel-cell div.buttons .button:last-child { | |
border-top-width: 0px; | |
} | |
.carousel-cell:last-child { | |
border-radius: 0px 15px 15px 0px; | |
} | |
.carousel-cell:first-child { | |
border-radius: 15px 0px 0px 15px; | |
} | |
.carousel-cell:first-child > *:first-child { | |
border-radius: 15px 0px 0px 0px; | |
} | |
.carousel-cell:first-child .button:last-child { | |
border-radius: 0px 0px 0px 14px; | |
} | |
.carousel-cell:last-child > *:first-child { | |
border-radius: 0px 15px 0px 0px; | |
} | |
.carousel-cell:last-child .button:last-child { | |
border-radius: 0px 0px 15px 0px; | |
} | |
/* cell number */ | |
.carousel-cell2:before { | |
display: block; | |
text-align: center; | |
content: counter(gallery-cell); | |
line-height: 200px; | |
font-size: 80px; | |
color: white; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">// external js: flickity.pkgd.js | |
var items = $(".carousel-cell"); | |
var c = $('.carousel').flickity({ | |
freeScroll: false, | |
pageDots: false, | |
prevNextButtons: false | |
}); | |
function scroll(to) { | |
c.flickity( 'select', to++ ); | |
//console.log(items[to]); | |
if (to < items.length) { | |
setTimeout(function() { | |
scroll(to++); | |
}, 1000); | |
} | |
} | |
scroll(0); | |
// alert(items.length);</script></body> | |
</html> |
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: #EEE; */ | |
width: 280px; | |
} | |
.carousel-cell { | |
width: 66%; | |
/* height: 200px; */ | |
margin-right: 5px; | |
/* background: #8C8; */ | |
background: white; | |
border-radius: 0px; | |
counter-increment: gallery-cell; | |
border: 1px solid #97A2A8; | |
border-bottom-width: 0px; | |
} | |
.carousel-cell img.header { | |
width: 100%; | |
} | |
.carousel-cell div.heading { | |
} | |
.carousel-cell div.buttons { | |
text-align: center; | |
} | |
.carousel-cell div.buttons .button { | |
background: white; | |
padding: 5px 0px; | |
border-top: 1px solid #1683FB; | |
border-bottom: 1px solid #1683FB; | |
} | |
.carousel-cell div.buttons .button:first-child { | |
border-bottom-width: 0px; | |
} | |
.carousel-cell div.buttons .button:last-child { | |
border-top-width: 0px; | |
} | |
.carousel-cell:last-child { | |
border-radius: 0px 15px 15px 0px; | |
} | |
.carousel-cell:first-child { | |
border-radius: 15px 0px 0px 15px; | |
} | |
.carousel-cell:first-child > *:first-child { | |
border-radius: 15px 0px 0px 0px; | |
} | |
.carousel-cell:first-child .button:last-child { | |
border-radius: 0px 0px 0px 14px; | |
} | |
.carousel-cell:last-child > *:first-child { | |
border-radius: 0px 15px 0px 0px; | |
} | |
.carousel-cell:last-child .button:last-child { | |
border-radius: 0px 0px 15px 0px; | |
} | |
/* cell number */ | |
.carousel-cell2:before { | |
display: block; | |
text-align: center; | |
content: counter(gallery-cell); | |
line-height: 200px; | |
font-size: 80px; | |
color: white; | |
} |
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 | |
var items = $(".carousel-cell"); | |
var c = $('.carousel').flickity({ | |
freeScroll: false, | |
pageDots: false, | |
prevNextButtons: false | |
}); | |
function scroll(to) { | |
c.flickity( 'select', to++ ); | |
//console.log(items[to]); | |
if (to < items.length) { | |
setTimeout(function() { | |
scroll(to++); | |
}, 1000); | |
} | |
} | |
scroll(0); | |
// alert(items.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment