JSFiddle - React, Tailwind, and code Playground
by csaltyj
HTML
<div id="story-container">
<div class="story">
<img src="http://www.westernjournalism.com/wp-content/uploads/2011/04/Barack-Obama-There-Might-Be-Chances-of-Further-Offshore-Drilling-Campaigns.jpg" />
<div class="story-text">
<h4>Obama is pointing at you!</h4>
<p>It is this very gaze, and this very pointed finger, that actually killed Osama bin Laden.</p>
</div>
</div>
<div class="story">
<img src="http://reason.com/assets/mc/jtaylor/rahm.jpg" />
<div class="story-text">
<h4>Rahm acts silly</h4>
<p>Snort!</p>
</div>
</div>
</div>
<div id="sidebar">
</div>
CSS
#story-container {
margin-top: 2em;
width: 300px;
height: 200px;
position: relative;
float: left;
overflow: hidden;
}
#sidebar {
float: left;
margin-top: 2em;
height: 200px;
width: 65px;
}
#story-container .story {
position: absolute;
height: 100%;
}
#story-container .story img {
width: 100%;
height: 100%;
}
#story-container .story-text {
background: rgba(0, 0, 0, 0.7);
color: #fff;
position: absolute;
bottom: 0;
height: 45px;
width: 280px;
padding: 10px;
}
#story-container .story p {
font-size: 0.7em;
}
#sidebar .story {
position: static;
width: 65px;
height: 65px;
}
#sidebar .story img {
width: 100%;
height: 100%;
}
#sidebar .story-text {
color: #fff;
position: relative;
font-size: 0.6em;
font-weight: bold;
bottom: 30px;
}
#sidebar .story-text p {
display: none;
}
JavaScript
/* Clone & shrink test */
var $carousel = $('#story-container');
$('.story:first', $carousel).css('z-index', 1);
/*var $st = $('.story:first', $carousel).clone();
$('#sidebar').append($st);*/
$('.story', $carousel).clone().appendTo('#sidebar');