Skip to content

Instantly share code, notes, and snippets.

@muriloazevedo
Last active December 19, 2015 06:49
Show Gist options
  • Save muriloazevedo/5914561 to your computer and use it in GitHub Desktop.
Save muriloazevedo/5914561 to your computer and use it in GitHub Desktop.
carrousel bootstrap
<script type='text/javascript' src="js/scrollingCarousel.js"></script>
<link rel="stylesheet" type="text/css" href="css/home.css" />
<div class="container">
<script type='text/javascript'>
$(function() {
/* CALCULA O COMPRIMENTO DO CARROSEL ANTES DO START */
var carousel = $('#carousel');
$('.carousel-demo').scrollingCarousel({
autoScrollSpeed: '40000', //milesegundos
scrollSpeed: 'slow', //slow, medium, fast
autoScroll: true, //true, false
});
});
</script>
<div class="row-fluid content">
<div id="carousel-demo2" class="carousel-demo">
<ul>
<?php for($i = 0; $i < 10; $i++):?>
<li class="contentBox thumbnail">
<img src="http://placehold.it/370x370" />
<div class="caption">
<!-- Hover content -->
<div class="inner-caption span3 offset4">
<h4 class="span12">Imperdível</h4>
<p class="preco span7">
De R$ 200,00 por <span class="desconto">89,00</span>
<a href="outlet_product_detail.php" class="span12">+detalhes</a>
<a href="outlet_checkout.php" class="btn btn-warning checkout">Comprar</a>
</p>
</div>
</div>
</li>
<?php endfor?>
</ul>
</div>
</div>
<div class="row-fluid">
<div id="carousel" class="carousel-demo">
<ul>
<?php for($i = 0; $i < 10; $i++):?>
<li class="contentBox thumbnail">
<img src="http://placehold.it/275x275" />
<div class="caption span3">
<!-- Hover content -->
<div class="inner-caption">
<h4>Imperdível</h4>
<p class="preco span4 offset2">
De R$ 200,00 por <span class="desconto">89,00</span>
<a href="outlet_product_detail.php">+detalhes</a>
<a href="outlet_checkout.php" class="btn btn-warning checkout">Comprar</a>
</p>
</div>
</div>
</li>
<?php endfor?>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="carousel slide span12" id="myCarousel3">
<div class="carousel-inner">
<?php for($i = 0; $i < 2; $i++):?>
<div class="item <?php echo $i == 0 ? 'active' : '' ?>">
<div class="span2 slide">
<div class="thumbnail span12">
<img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;">
</div>
</div>
<div class="span2 slide">
<div class="thumbnail">
<img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;">
</div>
</div>
<div class="span2 slide">
<div class="thumbnail">
<img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;">
</div>
</div>
<div class="span2 slide">
<div class="thumbnail">
<img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;">
</div>
</div>
<div class="span2 slide">
<div class="thumbnail span12">
<img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;">
</div>
</div>
<div class="span2 slide">
<div class="thumbnail">
<img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;">
</div>
</div>
</div><!--/item-->
<?php endfor ?>
</div>
<a data-slide="prev" href="#myCarousel3" class="left carousel-control">‹</a>
<a data-slide="next" href="#myCarousel3" class="right carousel-control">›</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#myCarousel3').carousel({
interval : 10000
});
});
</script>
.carousel-demo {
width:560px;
}
#carousel{
height: 300px !important;
}
#mixedContent {
width: 100%;
height: 100%;
position: relative;
margin:20px 0;
}
#myCarousel {
width:100%;
height: 330px;
position: relative;
}
.thumbnail > img {
margin:0;
padding:0;
width: 100%
}
.thumbnail{
padding:0;
text-align: right
}
.thumbnail h3{
color:#f89406;
float:left;
margin-right:15px;
width:350px;
position: absolute;
display: block;
text-transform: uppercase
}
.thumbnail .caption {
display: block
}
li:hover.thumbnail .caption {
display: block;
position: absolute;
top: 0;
background: #000;
opacity: 0.65;
margin: 0;
height:370px;
width: 370px
}
.inner-caption{
color:#fff;
margin:50px 50px;
display: block;
}
.inner-caption a{
color:#fff;
}
.inner-caption h4{
font-size:16px;
text-transform: uppercase;
margin-left: 20.205128205128204%;
}
.inner-caption .preco{
line-height:1.5;
float:left;
font-size:14px;
display:block;
height:60px;
}
.inner-caption .preco .desconto{
margin:5px 0;
clear:both;
font-size:1.6em;
}
#myCarousel2 .inner-caption h4{
font-size: 1em;
margin-left: 25.205128205128204%;
}
#myCarousel2 .inner-caption .preco{
font-size: 0.8em;
}
#myCarousel2 div:hover.thumbnail .caption {
width: 23.404255319148934%;
}
.inner-caption .btn{
float: left;
clear: both
}
.thumbnail .caption {
padding:0;
margin:0;
}
.thumbnail a:hover p span {
position: absolute;
top: 60%;
margin-left: -40px;
margin-top: 10px;
}
.carousel-demo {
width:100%;
height:300px !important;
}
.carousel-demo-vertical {
width:500px;
}
.carousel-demo li {
width:370px;
float:left;
font-weight:bold;
font-size:3em;
height:65px;
list-style:none;
margin:0;
text-align:center;
}
.carousel-control{
padding: 15px 5px 0 5px;
}
#carousel.carousel-demo li{
width:250px;
}
#carousel.carousel-demo li:hover.thumbnail .caption {
width:250px;
height:250px;
}
.carousel-demo-vertical li {
margin:0 0 10px 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment