Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="wrap">
	<h1 class="pen-title">Owl Carousel - Single Slide / Caption Overlay with SVG Nav</h1>
	<p class="pen-description">Using OwlCarousel.js to display single-image (at a time) in carousel with caption overlay, and SVG navigation.</p>
	
	<!-- Begin Your Code -->
	<section class="owl-carousel owl-theme">
		<figure class="owl-item">
			<img src="http://www.placecage.com/800/450" alt="Nicholas Cage">
			<figcaption>Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.</figcaption>
		</figure>
		<figure class="owl-item">
			<img src="http://www.placecage.com/800/450" alt="Nicholas Cage">
		</figure>
		<figure class="owl-item">
			<img src="http://www.placecage.com/800/450" alt="Nicholas Cage">
			<figcaption>Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas.</figcaption>
		</figure>
		<figure class="owl-item">
			<img src="http://www.placecage.com/800/450" alt="Nicholas Cage"></figure>
	</section>
	<!-- End Your Code -->
	
</div><!-- .wrap -->
              
            
!

CSS

              
                .wrap {
	max-width: rem(800);
	text-align: center;
} // .wrap

// Owl Carousel Theme
.owl-theme {
	color: $color-white;
	
	figure {
		line-height: 0;
		margin: 0;
		position: relative;
	} // figure
	
	figcaption {
		background: rgba($color-black, 1);
		font-size: rem(14);
		line-height: 1.33;
		padding: rem(10) rem(20);
		text-align: left;
		z-index: 10;
		
		@include media($phone-landscape) {
			background: rgba($color-black, 0.8);
			bottom: 0;
			font-size: rem(16);
			left: 0;
			padding: rem(20) rem(40);
			right: 0;
			position: absolute;
		}
	} // figcaption
} // .owl-theme

.owl-controls {
	margin-top: rem(10);
	text-align: center;
	
	// Styling Next and Prev buttons
	.owl-buttons {
		
		div {
			@include position(absolute, 50% null null null);
			
			background: $color-blue;
			color: $color-white;
			display: inline-block;
			margin-top: rem(-12);
			opacity: 0.8;
			padding: rem(3) rem(10);
			zoom: 1;
			
			&:after {
				@include size(rem(48) rem(48));
		
				background-size: cover;
				content: '';
				display: inline-block;
			}
		} // div
		
		span {
			@extend .screen-reader-text !optional;
		} // span
		
		.owl-prev {
			left: 0;
			
			&:after {
				background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/476573/keyboard_arrow_left.svg') center center no-repeat;
			}
		} // .owl-prev
		
		.owl-next {
			right: 0;
			
			&:after {
				background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/476573/keyboard_arrow_right.svg') center center no-repeat;
			}
		} // .owl-next
	} // .owl-buttons
	
	// Styling Pagination
	.owl-page {
		display: inline-block;
		*display: inline; /*IE7 life-saver */
		zoom: 1;
		
		span {
			@include size(rem(12) rem(12));
			
			background: $color-blue;
			border-radius: 50%;
			display: block;
			filter: Alpha(Opacity=70); /*IE7 fix*/
			margin: rem(5) rem(7);
			opacity: 0.7;
			
			// If PaginationNumbers is true
			&.owl-numbers {
				@include size(auto auto);
				
				border-radius: rem(30);
				color: $color-white;
				font-size: rem(12);
				padding: rem(2) rem(10);
			} // span.owl-numbers
		} // span
		
		&.active span {
			filter: Alpha(Opacity=100); /*IE7 fix*/
			opacity: 1;
		}
	} // .owl-page
	
	// Clickable class fix problem with hover on touch devices
	// Use it for non-touch hover action
	&.clickable {
		
		.owl-buttons {
			
			div:hover {
				filter: Alpha(Opacity=100); /*IE7 fix*/
				opacity: 1;
				text-decoration: none;
			}
		} // .owl-buttons
		
		.owl-page:hover span {
			filter: Alpha(Opacity=100); /*IE7 fix*/
			opacity: 1;
		}
	} // .owl-controls.clickable
} // .owl-controls

// each image
.owl-item {
	
	// preloading images
	&.loading {
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/476573/AjaxLoader.gif) no-repeat center center;
		min-height: rem(150);
	}
} // .owl-item
              
            
!

JS

              
                // Simple example of OwlCarousel.js
window.OwlCarousel = {};
( function( window, $, that ) {

	// Constructor.
	that.init = function() {
		that.cache();

		if ( that.meetsRequirements ) {
			that.bindEvents();
		}
	};

	// Cache all the things.
	that.cache = function() {
		that.$c = {
			window: $( window ),
			carousel: $( '.owl-carousel' ),
		};
	};

	// Combine all events.
	that.bindEvents = function() {
		that.$c.window.on( 'load', that.owlCarousel_init );
	};

	// Do we meet the requirements?
	that.meetsRequirements = function() {
		return that.$c.carousel.length;
	};

	// Initialize Owl Carousel with options
	// http://owlgraphic.com/owlcarousel/index.html#customizing
	that.owlCarousel_init = function() {
		that.$c.carousel.owlCarousel({
			navigation : true, // Show next and prev buttons
			navigationText: ['<span>Previous</span>', '<span>Next</span>'],
			slideSpeed : 300,
			paginationSpeed : 400,
			singleItem:true
		})
	};

	// Engage!
	$( that.init );
	
})( window, jQuery, window.OwlCarousel );
              
            
!
999px

Console