cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div id="slider-wrapper">
		<div id="dots">
			<ul>
				<li class="active"></li>
				<li></li>
				<li></li>
			</ul>
		</div>
		<div id="arrow-left" class="nav-arrow"></div>
		<div id="image-slider">
			<ul>
				<li class="active-img"><img src="http://www.derekhilldesign.com/projects/slider-header/images/sunset.jpg" alt="" /></li><li><img src="http://www.derekhilldesign.com/projects/slider-header/images/lele.jpg" alt="" /></li><li><img src="http://www.derekhilldesign.com/projects/slider-header/images/logo.jpg" alt="" /></li>
			</ul>
			<div id="nav-bar">
					<a href="#"><div><img src="http://www.derekhilldesign.com/projects/slider-header/images/thumb-web.jpg" /></div>Web</a><a href="#"><div><img src="http://www.derekhilldesign.com/projects/slider-header/images/thumb-print.jpg" /></div>Print</a><a href="#"><div><img src="http://www.derekhilldesign.com/projects/slider-header/images/thumb-logo.jpg" /></div>Logos</a><a href="#"><div><img src="http://www.derekhilldesign.com/projects/slider-header/images/thumb-photo.jpg" /></div>Photos</a>
			</div>
		</div>
		<div id="arrow-right" class="nav-arrow"></div>
	</div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Questrial);
	
	body{
		padding: 0;
		margin: 0;
		background: #24282c;
		font-family: "Questrial", Arial, Helvetica, sans-serif;
	}
	
	#slider-wrapper{
		width: 1024px;
		height: auto;
		margin: 20px auto;
		text-align: center;
	}
	
	#dots{
		cursor: default;
	}
	
	ul{
		padding: 0;
		margin: 0;
	}
	
	#dots li{
		display: inline-block;
			*display: inline;
			zoom: 1.0;
		background: #61676D;
		width: 10px;
		height: 10px;
		border-radius: 8px;
		margin: 0 2px;
		cursor: pointer;
	}
	
	#dots li.active, #dots li:hover{
		background: #c4c9cf;
	}
	
	
	.nav-arrow{
		width: 46px;
		height: 343px;
		display: inline-block;
			*display: inline;
			zoom: 1.0;
		cursor: pointer;
	}
	
	#arrow-left{
		background: url(http://www.derekhilldesign.com/projects/slider-header/images/arrow-left.png) center center no-repeat;
	}
	
	#arrow-right{
		background: url(http://www.derekhilldesign.com/projects/slider-header/images/arrow-right.png) center center no-repeat;
	}
	
	#arrow-right:hover, #arrow-left:hover{
		background-color: #1e2225;
	}
	
	#image-slider{
		width: 923px;
		height: 343px;
		position: relative;
		margin-top: 10px;
		overflow: hidden;
		display: inline-block;
			*display: inline;
			zoom: 1.0;
	}
	
	#slider-wrapper:before{
		content: '';
		width: 974px;
		height: 52px;
		display: block;
		position: absolute;
		left: 50%;
		margin-left: -487px;
		top: 375px;
		background: url(http://www.derekhilldesign.com/projects/slider-header/images/shadow.png) center center no-repeat;
	}
	#image-slider ul{
		width: 923px;
		height: 343px;
		position: relative;
	}
	#image-slider ul li{
		display: inline-block;
			*display: inline;
			zoom: 1.0;
		position: absolute;
		top: 0;
		left: -923px;
	}
	
	#image-slider ul li.active-img{
		left: 0;
	}
	.next-img{
		z-index: 9999;
	}
	
	#nav-bar{
		width: 923px;
		position: absolute;
		z-index: 999999;
		bottom: -3px;
	}
	
	#nav-bar a{
		display: inline-block;
			*display: block;
			zoom: 1.0;
		width: 231px;
		text-align: center;
		height: 26px;
		padding-top: 9px;
		color: #fff;
		overflow: hidden;
		font-size: 21px;
		text-shadow: 0 1px 5px #000;
		text-decoration: none;
		position: relative;
		background: rgba(2, 19, 32, 0.9);
		-webkit-transition: padding-top .25s;
		-moz-transition: padding-top .25s;
		transition: padding-top .25s;
	}
	
	#nav-bar a:first-child{
		width: 230px;
	}
	
	#nav-bar a div{
		height: 0;
		width: 231px;
		overflow: hidden;
		position: absolute;
		left: 0;
		bottom: 0;
	}
	
	#nav-bar a div img{
		position: absolute;
		left: 0;
		bottom: 0;
		opacity: 0.3;
	}
	
	#nav-bar a:hover{
		padding-top: 317px;
		box-shadow: 0 0 5px #000;
	}
	
	#nav-bar a:hover div{
		height: 343px;
	}
            
          
!
            
              $(function(){
		
		var sliderInterval = setInterval(function() {
     		nextImg();
		}, 7000);
		
		$('.nav-arrow').click(function(){
			if($(this).attr('id') == 'arrow-left'){
				prevImg();
			}else{
				nextImg();
			}
			
			clearInterval(sliderInterval);
			
		});
		
		$('#dots li').click(function(){
			var thisIndex = $(this).index()
			
			if(thisIndex < $('#dots li.active').index()){
				prevDot(thisIndex);
			}else if(thisIndex > $('#dots li.active').index()){
				nextDot(thisIndex);
			}
			
			$('#dots li.active').removeClass('active');
			$(this).addClass('active');
			
			clearInterval(sliderInterval);
			
		});
	})
	
	function prevImg(){
		var curIndex = $('#image-slider li.active-img').index();
		
		if(curIndex == 0){
			$('#image-slider li:last-child').addClass('next-img').animate({
				left: 0
			}, function(){
				$('#image-slider li.active-img').removeClass('active-img').css('left', '-923px');
				$('#image-slider li.next-img').attr('class', 'active-img');
				
				var nextIndex = $('#image-slider li.active-img').index();
				
				$('#dots li.active').removeClass('active');
				$('#dots li').eq(nextIndex).addClass('active');
			});
		}else{
			$('#image-slider li.active-img').prev().addClass('next-img').animate({
				left: 0
			}, function(){
				$('#image-slider li.active-img').removeClass('active-img').css('left', '-923px');
				$('#image-slider li.next-img').attr('class', 'active-img');
				
				var nextIndex = $('#image-slider li.active-img').index();
				
				$('#dots li.active').removeClass('active');
				$('#dots li').eq(nextIndex).addClass('active');
			});
		}
	}
	
	function nextImg(){
		var curIndex = $('#image-slider li.active-img').index();
		
		if(curIndex == $('#image-slider li').length - 1){
			$('#image-slider li:first-child').addClass('next-img').css('left', 923).animate({
				left: 0
			}, function(){
				$('#image-slider li.active-img').removeClass('active-img').css('left', '-923px');
				$('#image-slider li.next-img').attr('class', 'active-img');
				
				var nextIndex = $('#image-slider li.active-img').index();
				
				$('#dots li.active').removeClass('active');
				$('#dots li').eq(nextIndex).addClass('active');
			});
		}else{
			$('#image-slider li.active-img').next().addClass('next-img').css('left', 923).animate({
				left: 0
			}, function(){
				$('#image-slider li.active-img').removeClass('active-img').css('left', '-923px');
				$('#image-slider li.next-img').attr('class', 'active-img');
				
				var nextIndex = $('#image-slider li.active-img').index();
				
				$('#dots li.active').removeClass('active');
				$('#dots li').eq(nextIndex).addClass('active');
			});
		}
	}
	
	function prevDot(newIndex){
		$('#image-slider li').eq(newIndex).addClass('next-img').animate({
			left: 0
		}, function(){
			$('#image-slider li.active-img').removeClass('active-img').css('left', '-923px');
			$('#image-slider li.next-img').attr('class', 'active-img');
		});
	}
	
	function nextDot(newIndex){
		$('#image-slider li').eq(newIndex).addClass('next-img').css('left', 923).animate({
			left: 0
		}, function(){
			$('#image-slider li.active-img').removeClass('active-img').css('left', '-923px');
			$('#image-slider li.next-img').attr('class', 'active-img');
		});
	}
            
          
!
999px
Loading ..................

Console