Skip to content

Instantly share code, notes, and snippets.

@jmg
Created November 22, 2016 04:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmg/5af35b7f4ac6c9f3a43e8aa43b1df902 to your computer and use it in GitHub Desktop.
Save jmg/5af35b7f4ac6c9f3a43e8aa43b1df902 to your computer and use it in GitHub Desktop.
Bootstrap Carrusel
<!DOCTYPE html>
<html lang="en">
<head>
<title>Carrusel Ejemplo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Archivos de bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
/* Para el ancho y alto de las imagenes. Modificalo a gusto =) */
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
width: 100%;
height: 500px;
margin: auto;
}
/* Para los margenes del contendor de las fotos. Podes cambiarle el ancho a gusto tambien! */
.carousel-control {
width: 10%;
}
</style>
</head>
<body>
<div class="container">
<br>
<div id="carrusel" class="carousel slide" data-ride="carousel">
<!-- Opcional, bullets abajo para saltar directamente a una foto (si los pones tiene q haber 1 por foto) -->
<ol class="carousel-indicators">
<li data-target="#carrusel" data-slide-to="0" class="active"></li>
<li data-target="#carrusel" data-slide-to="1"></li>
<li data-target="#carrusel" data-slide-to="2"></li>
</ol>
<!-- Contenedor de las fotos -->
<div class="carousel-inner" role="listbox">
<!-- Foto 1 -->
<div class="item active">
<img src="http://4.bp.blogspot.com/-_nHaa6uP40w/UQfDTi8e0bI/AAAAAAAAerU/OtmyUPDBPMA/s1600/mountains-wallpaper-6.jpg">
</div>
<!-- Foto 2 -->
<div class="item">
<img src="http://3.bp.blogspot.com/-3OaZaBQcHMA/UQfHBsAKH7I/AAAAAAAAfUw/iSuv21iJ7kI/s1600/friendly-little-bear-mountains.jpg">
</div>
<!-- Foto 3 -->
<div class="item">
<img src="https://c1.staticflickr.com/7/6236/6233434292_19ae1f1179_b.jpg">
</div>
</div>
<!-- Controles para pasar las fotos -->
<a class="left carousel-control" href="#carrusel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carrusel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment