Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
	<h1>Slider | <a href="http://creaticode.com/blog">Creaticode</a></h1>
	<!-- ==================================== 
	Contenedor Slider 
	=======================================-->
	<section id="slider" class="container">
		<ul class="slider-wrapper">
		<li class="current-slide">
			<img src="http://i9.photobucket.com/albums/a88/creaticode/1_zpsc6871490.jpg" title="" alt="">

			<div class="caption">
				<h2 class="slider-title">Diseño web</h2>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore, placeat est. Alias illo hic quo nobis, aspernatur iste ut voluptate.</p>
			</div>
		</li>

		<li>
			<img src="http://i9.photobucket.com/albums/a88/creaticode/2_zps6ccd36bd.jpg" title="" alt="">

			<div class="caption">
				<h2 class="slider-title">Diseño Responsive</h2>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo iusto placeat aliquid tempore harum, similique!</p>
			</div>
		</li>

		<li>
			<img src="http://i9.photobucket.com/albums/a88/creaticode/4_zps611bc9f9.jpg" title="" alt="">

			<div class="caption">
				<h2 class="slider-title">Identidad Corporativa</h2>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dignissimos dicta laudantium voluptatem minima! Dolorum tempore dolores excepturi omnis provident. Commodi quis aperiam maiores, dolore a perferendis!</p>
			</div>
		</li>

		<li>
			<img src="http://i9.photobucket.com/albums/a88/creaticode/3_zps70e4fcc5.jpg" title="" alt="">

			<div class="caption">
				<h2 class="slider-title">Desarrollo Web</h2>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Autem dolore dignissimos laudantium.</p>
			</div>
		</li>
		</ul>
		<!-- Sombras -->
		<div class="slider-shadow"></div>
		
		<!-- Controles de Navegacion -->
		<ul id="control-buttons" class="control-buttons"></ul>
	</section>
	
	
	<!-- Imagenes Copyright -->
	<p class="authors">
		Las imagenes usadas en esta demostracíon no son de mi propiedad. <a href="https://www.flickr.com/photos/flickr/galleries/72157645330786244/">Autores de las Imagenes</a>
	</p>
            
          
!
            
              * {
	margin: 0;
	padding: 0;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}

body {
	background: #242c38;
	font-family: 'Roboto';
	font-size: 62.5%;
}

.clearfix:after {
	content: '';
	clear: both;
	display: block;
	height: 0;
	width: 0;
}

ul {
	list-style-type: none;
}

a {
	color: #00c5b9;
	text-decoration: none;
}

h1 {
	color: #FFF;
	text-align: center;
	margin-top: 30px;
	font-weight: 300;
	font-size: 2.4em;
}

/** ---------------------------------------
 * Slider 
 ----------------------------------------*/
.container {
	width: 800px;
	margin: 40px auto 0;
}

.slider-wrapper {
	z-index: 500;
	position: relative;
	width: 100%;
	height: 360px;
	background: #FFF;
	border: 5px solid #4b5973;
	overflow: hidden;
}

.slider-wrapper li {
	display: none;
}

.slider-wrapper .current-slide {
	display: block;
}

.slider-shadow {
	width: 100%;
	height: 15px;
	position: relative;
}

.slider-shadow:after, .slider-shadow:before {
	content: '';
	position: absolute;
	background: #171c24;
	height: 100%;
	width: 50%;
	left: 10px;
	top: -20px;
	-webkit-transform: rotate(-4deg);
	-ms-transform: rotate(-4deg);
	-o-transform: rotate(-4deg);
	transform: rotate(-4deg);
	-webkit-box-shadow: 0 0 15px 8px #171c24;
	box-shadow: 0 0 15px 8px #171c24;
}

.slider-shadow:before {
	right: 10px;
	left: auto;
	-webkit-transform: rotate(4deg);
	-ms-transform: rotate(4deg);
	-o-transform: rotate(4deg);
	transform: rotate(4deg);
}

.slider-wrapper img {
	position: absolute;
	max-width: 100%;
	height: auto;
	top: 0;
	left: 0;
}

/**
 * ---[Caption] ---------------------- 
 **/
.slider-wrapper .caption {
	position: absolute;
	bottom: 0;
	left: 0;
	background: rgba(0,0,0,0.65);
	width: 100%;
	padding: 10px;
	color: #FFF;
	-webkit-transform: translateY(100%);
	-ms-transform: translateY(100%);
	-o-transform: translateY(100%);
	transform: translateY(100%);
	opacity: 0;
	-webkit-transition: all 0.4s ease;
	-o-transition: all 0.4s ease;
	transition: all 0.4s ease;
}

.slider-wrapper li:hover .caption {
	-webkit-transform: translateY(0);
	-ms-transform: translateY(0);
	-o-transform: translateY(0);
	transform: translateY(0);
	opacity: 1;
}


.slider-wrapper h2 {
	color: #00c5b9;
	font-size: 2em;
	font-weight: 400;
	margin-bottom: 6px;
}

.slider-wrapper p {
	font-size: 1.6em;
	font-weight: 300;
	line-height: 1.4em;
}

/**
 * ---[Botones-Control] ---------------------- 
 **/
.control-buttons {
	margin-top: 15px;
	text-align: center;
}

.control-buttons li {
	cursor: pointer;
	display: inline-block;
	background: #424f66;
	text-indent: -99999px;
	height: 12px;
	width: 12px;
	margin: 0 6px;
	-webkit-border-radius: 50%;
	-moz-border-radius: 50%;
	border-radius: 50%;
}

.control-buttons li.active {
	background: #00c5b9;
}

.authors {
	text-align: center;
	color: #7a8699;
	display: block;
	font-size: 1.6em;
	font-weight: 300;
	margin-top: 80px;
	font-size: 300;
}

/** ---------------------------------------
 * Responsive 
 ----------------------------------------*/
 @media only screen and (max-width: 825px) {
 	.container {
 		width: 500px;
 	}

 	.slider-wrapper {
 		height: 260px;
 	}
 }

 @media only screen and (max-width: 535px) {
 	.container {
 		padding: 5px;
 		width: 100%;
 		margin: 40px 0 0 0;
 	}

 	.slider-wrapper {
 		height: 200px;
 	}
	
 	.slider-wrapper .caption {
 		display: none;
 	}

 }

 @media only screen and (max-width: 410px) {
 	.slider-wrapper {
 		height: 160px;
 	}
 }
            
          
!
            
              /**
 * @Titulo: Slider Responsivo
 * @Autor: Creaticode
 * @URL: http://creaticode.com 
 */
$(function() {
	/** -----------------------------------------
	 * Modulo del Slider 
	 -------------------------------------------*/
	 var SliderModule = (function() {
	 	var pb = {};
	 	pb.el = $('#slider');
	 	pb.items = {
	 		panels: pb.el.find('.slider-wrapper > li'),
	 	}

	 	// Interval del Slider
	 	var SliderInterval,
	 		currentSlider = 0,
	 		nextSlider = 1,
	 		lengthSlider = pb.items.panels.length;

	 	// Constructor del Slider
	 	pb.init = function(settings) {
	 		this.settings = settings || {duration: 8000};
	 		var items = this.items,
	 			lengthPanels = items.panels.length,
	 			output = '';

	 		// Insertamos nuestros botones
	 		for(var i = 0; i < lengthPanels; i++) {
	 			if(i == 0) {
	 				output += '<li class="active"></li>';
	 			} else {
	 				output += '<li></li>';
	 			}
	 		}

	 		$('#control-buttons').html(output);

	 		// Activamos nuestro Slider
	 		activateSlider();
	 		// Eventos para los controles
	 		$('#control-buttons').on('click', 'li', function(e) {
	 			var $this = $(this);
	 			if(!(currentSlider === $this.index())) {
	 				changePanel($this.index());
	 			}
	 		});

	 	}

	 	// Funcion para activar el Slider
	 	var activateSlider = function() {
	 		SliderInterval = setInterval(pb.startSlider, pb.settings.duration);
	 	}

	 	// Funcion para la Animacion
	 	pb.startSlider = function() {
	 		var items = pb.items,
	 			controls = $('#control-buttons li');
	 		// Comprobamos si es el ultimo panel para reiniciar el conteo
	 		if(nextSlider >= lengthSlider) {
	 			nextSlider = 0;
	 			currentSlider = lengthSlider-1;
	 		}

	 		controls.removeClass('active').eq(nextSlider).addClass('active');
	 		items.panels.eq(currentSlider).fadeOut('slow');
	 		items.panels.eq(nextSlider).fadeIn('slow');

	 		// Actualizamos los datos del slider
	 		currentSlider = nextSlider;
	 		nextSlider += 1;
	 	}

	 	// Funcion para Cambiar de Panel con Los Controles
	 	var changePanel = function(id) {
	 		clearInterval(SliderInterval);
	 		var items = pb.items,
	 			controls = $('#control-buttons li');
	 		// Comprobamos si el ID esta disponible entre los paneles
	 		if(id >= lengthSlider) {
	 			id = 0;
	 		} else if(id < 0) {
	 			id = lengthSlider-1;
	 		}

	 		controls.removeClass('active').eq(id).addClass('active');
	 		items.panels.eq(currentSlider).fadeOut('slow');
	 		items.panels.eq(id).fadeIn('slow');

	 		// Volvemos a actualizar los datos del slider
	 		currentSlider = id;
	 		nextSlider = id+1;
	 		// Reactivamos nuestro slider
	 		activateSlider();
	 	}

		return pb;
	 }());

	 SliderModule.init({duration: 4000});

});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console