<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codrops &#187; slideshow</title>
	<atom:link href="http://tympanus.net/codrops/tag/slideshow/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Thu, 23 May 2013 13:36:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Morphing Devices</title>
		<link>http://tympanus.net/codrops/2013/05/15/morphing-devices/</link>
		<comments>http://tympanus.net/codrops/2013/05/15/morphing-devices/#comments</comments>
		<pubDate>Wed, 15 May 2013 11:52:18 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Playground]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=15036</guid>
		<description><![CDATA[An experimental morphing devices slideshow with CSS Transitions for showcasing responsive web design screenshots. ]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/MorphingDevices/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/05/MorphingDevices.jpg" alt="MorphingDevices" width="580" height="315" class="alignnone size-full wp-image-15081" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/MorphingDevices/">View demo</a> <a class="download" href="http://tympanus.net/Development/MorphingDevices/MorphingDevices.zip">Download source</a></p>
<p>Today we want to share an experimental &#8220;morphing&#8221; slideshow with you. The idea is to transition between different devices that show a screenshot of a responsive website or app by applying a &#8220;device class&#8221;. By using the same elements and pseudo-elements for all the devices, we can create an interesting morph effect. We will control the classes and the switching of the image with some JavaScript. We&#8217;ve also added an option for autoplaying the slideshow and for rotating some of the devices.</p>
<div class="ct-special-box"><strong>Please note that this is very experimental and only works as intended in browsers that support the respective CSS properties.</strong></div>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/05/MorphingDevices_iMac.jpg" alt="MorphingDevices_iMac" width="814" height="623" class="alignnone size-full wp-image-15078" /></p>
<p>There are four devices which we will use to display different screenshots of responsive designs. Two of them, the tablet and the smartphone, can also be rotated. What we do is to interchange the classes depending on the device and since the device has transitions defined, we&#8217;ll see a morphing effect. Note that we also animate pseudo-elements here which might not be supported in all browsers (especially mobile browsers).</p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/05/MorphingDevices_MacBook.jpg" alt="MorphingDevices_MacBook" width="814" height="491" class="alignnone size-full wp-image-15077" /></p>
<p>The rotation on the last two devices happens by adding another class which will rotate the device 90 degrees. </p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/05/MorphingDevices_iPad.jpg" alt="MorphingDevices_iPad" width="814" height="531" class="alignnone size-full wp-image-15076" /></p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<p>The images are changed by adding the new picture and fading out the previous one. This also creates a morphing effect where the image gets stretched or squeezed to accomodate the new size. </p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/05/MorphingDevices_iPhone.jpg" alt="MorphingDevices_iPhone" width="784" height="488" class="alignnone size-full wp-image-15075" /></p>
<p>The better technology to choose for this kind of effect is undoubtedly SVG, but for practicality reasons we started this experiment with CSS and JS.</p>
<p>We hope you like and enjoy it and get inspired!</p>
<div class="ct-github-link"><a href="https://github.com/codrops/MorphingDevices">Find this project on Github</a></div>
<p><a class="demo" href="http://tympanus.net/Development/MorphingDevices/">View demo</a> <a class="download" href="http://tympanus.net/Development/MorphingDevices/MorphingDevices.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2013/05/15/morphing-devices/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Background Slideshow</title>
		<link>http://tympanus.net/codrops/2013/04/17/background-slideshow/</link>
		<comments>http://tympanus.net/codrops/2013/04/17/background-slideshow/#comments</comments>
		<pubDate>Wed, 17 Apr 2013 12:30:13 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Blueprints]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=14667</guid>
		<description><![CDATA[A fullscreen background slideshow with autoplay functionality.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Blueprints/BackgroundSlideshow/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/04/BlueprintBackgroundSlideshow1.jpg" alt="Background Slideshow" width="580" height="315" class="alignnone size-full wp-image-14743" /></a></p>
<p><a class="demo" href="http://tympanus.net/Blueprints/BackgroundSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Blueprints/BackgroundSlideshow/BackgroundSlideshow.zip">Download source</a></p>
<p>A simple fullscreen background slideshow with auto-play and controls to navigate and pause.</p>
<h3>The HTML</h3>
<pre class="brush:html; gutter:false;">
&lt;ul id="cbp-bislideshow" class="cbp-bislideshow"&gt;
	&lt;li&gt;&lt;img src="images/1.jpg" alt="image01"/&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src="images/2.jpg" alt="image02"/&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src="images/3.jpg" alt="image03"/&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src="images/4.jpg" alt="image04"/&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src="images/5.jpg" alt="image05"/&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src="images/6.jpg" alt="image06"/&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id="cbp-bicontrols" class="cbp-bicontrols"&gt;
	&lt;span class="cbp-biprev"&gt;&lt;/span&gt;
	&lt;span class="cbp-bipause"&gt;&lt;/span&gt;
	&lt;span class="cbp-binext"&gt;&lt;/span&gt;
&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<pre class="brush:css; gutter:false">
@font-face {
	font-family: 'entypo';
	src:url('../fonts/controls/entypo.eot');
	src:url('../fonts/controls/entypo.eot?#iefix') format('embedded-opentype'),
		url('../fonts/controls/entypo.woff') format('woff'),
		url('../fonts/controls/entypo.ttf') format('truetype'),
		url('../fonts/controls/entypo.svg#entypo') format('svg');
	font-weight: normal;
	font-style: normal;
}

.cbp-bislideshow {
	list-style: none;
	width: 100%;
	height: 100%;
	position: fixed;
	top: 0;
	left: 0;
	z-index: -1;
	padding: 0;
	margin: 0;
}

.cbp-bislideshow li {
	position: absolute;
	width: 101%;
	height: 101%;
	top: -0.5%;
	left: -0.5%;
	opacity: 0;
	-webkit-transition: opacity 1s;
	-moz-transition: opacity 1s;
	transition: opacity 1s;
}

/* If background-size supported we'll add the images to the background of the li */

.backgroundsize .cbp-bislideshow li {
	-webkit-background-size: cover;
	-moz-background-size: cover;
	background-size: cover;
	background-position: center center;
}

/* ...and hide the images */
.backgroundsize .cbp-bislideshow li img {
	display: none;
}

.cbp-bislideshow li img {
	display: block;
	width: 100%;
}

.cbp-bicontrols {
	position: fixed;
	width: 300px;
	height: 100px;
	margin: -50px 0 0 -150px;
	top: 50%;
	left: 50%;
}

.cbp-bicontrols span {
	float: left;
	width: 100px;
	height: 100px;
	position: relative;
	cursor: pointer;
}

.cbp-bicontrols span:before {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	text-align: center;
	font-family: 'entypo';
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 100px;
	font-size: 80px;
	color: #fff;
	-webkit-font-smoothing: antialiased;
	opacity: 0.7;
}

.cbp-bicontrols span:hover:before {
	opacity: 1;
}

.cbp-bicontrols span:active:before {
	top: 2px;
}

span.cbp-biplay:before {
	content: "\e002";
}

span.cbp-bipause:before {
	content: "\e003";
}

span.cbp-binext:before {
	content: "\e000";
}

span.cbp-biprev:before {
	content: "\e001";
}

.cbp-bicontrols span.cbp-binext {
	float: right;
}

/* Fallback */

.no-js.no-backgroundsize .cbp-bislideshow li:first-child {
	opacity: 1;
}

.no-js.backgroundsize .cbp-bislideshow li:first-child img {
	display: block;
}

</pre>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>The JavaScript</h3>
<pre class="brush:js; gutter:false">
&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;!-- imagesLoaded jQuery plugin by @desandro : https://github.com/desandro/imagesloaded --&gt;
&lt;script src="js/jquery.imagesloaded.min.js"&gt;&lt;/script&gt;
&lt;script src="js/cbpBGSlideshow.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
	$(function() {
		cbpBGSlideshow.init();
	});
&lt;/script&gt;
</pre>
<pre class="brush:js; gutter:false">
/**
 * cbpBGSlideshow.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
var cbpBGSlideshow = (function() {

	var $slideshow = $( '#cbp-bislideshow' ),
		$items = $slideshow.children( 'li' ),
		itemsCount = $items.length,
		$controls = $( '#cbp-bicontrols' ),
		navigation = {
			$navPrev : $controls.find( 'span.cbp-biprev' ),
			$navNext : $controls.find( 'span.cbp-binext' ),
			$navPlayPause : $controls.find( 'span.cbp-bipause' )
		},
		// current item´s index
		current = 0,
		// timeout
		slideshowtime,
		// true if the slideshow is active
		isSlideshowActive = true,
		// it takes 3.5 seconds to change the background image
		interval = 3500;

	function init( config ) {

		// preload the images
		$slideshow.imagesLoaded( function() {
			
			if( Modernizr.backgroundsize ) {
				$items.each( function() {
					var $item = $( this );
					$item.css( 'background-image', 'url(' + $item.find( 'img' ).attr( 'src' ) + ')' );
				} );
			}
			else {
				$slideshow.find( 'img' ).show();
				// for older browsers add fallback here (image size and centering)
			}
			// show first item
			$items.eq( current ).css( 'opacity', 1 );
			// initialize/bind the events
			initEvents();
			// start the slideshow
			startSlideshow();

		} );
		
	}

	function initEvents() {

		navigation.$navPlayPause.on( 'click', function() {

			var $control = $( this );
			if( $control.hasClass( 'cbp-biplay' ) ) {
				$control.removeClass( 'cbp-biplay' ).addClass( 'cbp-bipause' );
				startSlideshow();
			}
			else {
				$control.removeClass( 'cbp-bipause' ).addClass( 'cbp-biplay' );
				stopSlideshow();
			}

		} );

		navigation.$navPrev.on( 'click', function() { 
			navigate( 'prev' ); 
			if( isSlideshowActive ) { 
				startSlideshow(); 
			} 
		} );
		navigation.$navNext.on( 'click', function() { 
			navigate( 'next' ); 
			if( isSlideshowActive ) { 
				startSlideshow(); 
			}
		} );

	}

	function navigate( direction ) {

		// current item
		var $oldItem = $items.eq( current );
		
		if( direction === 'next' ) {
			current = current &gt; itemsCount - 1 ? ++current : 0;
		}
		else if( direction === 'prev' ) {
			current = current &lt; 0 ? --current : itemsCount - 1;
		}

		// new item
		var $newItem = $items.eq( current );
		// show / hide items
		$oldItem.css( 'opacity', 0 );
		$newItem.css( 'opacity', 1 );

	}

	function startSlideshow() {

		isSlideshowActive = true;
		clearTimeout( slideshowtime );
		slideshowtime = setTimeout( function() {
			navigate( 'next' );
			startSlideshow();
		}, interval );

	}

	function stopSlideshow() {
		isSlideshowActive = false;
		clearTimeout( slideshowtime );
	}

	return { init : init };

})();
</pre>
<div class="ct-github-link"><a href="https://github.com/codrops/Blueprint-BackgroundSlideshow">Find this project on Github</a></div>
<p><a class="demo" href="http://tympanus.net/Blueprints/BackgroundSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Blueprints/BackgroundSlideshow/BackgroundSlideshow.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2013/04/17/background-slideshow/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Flipping Circle Slideshow</title>
		<link>http://tympanus.net/codrops/2013/01/28/flipping-circle-slideshow/</link>
		<comments>http://tympanus.net/codrops/2013/01/28/flipping-circle-slideshow/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 13:09:38 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Playground]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=13951</guid>
		<description><![CDATA[A simple circular slideshow where we flip the image in order to navigate. ]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/CircleFlipSlideshow/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/01/FlippingCircleSlideshow.jpg" alt="Flipping Circle Slideshow" width="580" height="315" class="alignnone size-full wp-image-13955" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/CircleFlipSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Development/CircleFlipSlideshow/CircleFlipSlideshow.zip">Download source</a></p>
<p>Today we want to share a simple and fun circular slideshow with you. It&#8217;s an experimental concept and the idea is to flip a circle in a specific angle depending on which spot of the circle we click. There are three different possibilities for each side: top, middle and bottom. For example, when clicking on the top right part of the image, the circle will flip in the associated angle, making it look as if we press down that part and reveal the next image that is on the back face of the circle.</p>
<p>The demo features illustrations by <a href="http://cargocollective.com/isaac317">Isaac Montemayor</a>. See his works on <a href="http://dribbble.com/isaac317">Dribbble</a> or on his <a href="http://cargocollective.com/isaac317">website</a>.</p>
<p>This is how the structure looks like:</p>
<pre class="brush:html">
&lt;div id="fc-slideshow" class="fc-slideshow"&gt;
	&lt;ul class="fc-slides"&gt;
		&lt;li&gt;&lt;img src="images/1.jpg" /&gt;&lt;h3&gt;Hot&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/2.jpg" /&gt;&lt;h3&gt;Cold&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/3.jpg" /&gt;&lt;h3&gt;Light&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/4.jpg" /&gt;&lt;h3&gt;Dark&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/5.jpg" /&gt;&lt;h3&gt;Soft&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/6.jpg" /&gt;&lt;h3&gt;Hard&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/7.jpg" /&gt;&lt;h3&gt;Smooth&lt;/h3&gt;&lt;/li&gt;
		&lt;li&gt;&lt;img src="images/8.jpg" /&gt;&lt;h3&gt;Rough&lt;/h3&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>And we transform it into the following:</p>
<pre class="brush:html">
&lt;div id="fc-slideshow" class="fc-slideshow"&gt;

	&lt;ul class="fc-slides"&gt;
		&lt;!-- ... --&gt;
	&lt;/ul&gt;

	&lt;nav&gt;
		&lt;div class="fc-left"&gt;
			&lt;span&gt;&lt;/span&gt;
			&lt;span&gt;&lt;/span&gt;
			&lt;span&gt;&lt;/span&gt;
			&lt;i class="icon-arrow-left"&gt;&lt;/i&gt;
		&lt;/div&gt;
		&lt;div class="fc-right"&gt;
			&lt;span&gt;&lt;/span&gt;
			&lt;span&gt;&lt;/span&gt;
			&lt;span&gt;&lt;/span&gt;
			&lt;i class="icon-arrow-right"&gt;&lt;/i&gt;
		&lt;/div&gt;
	&lt;/nav&gt;

	&lt;div class="fc-flip"&gt;
		&lt;div class="fc-front"&gt;
			&lt;div&gt;&lt;img src="images/4.jpg"&gt;&lt;h3&gt;Dark&lt;/h3&gt;&lt;/div&gt;
			&lt;div class="fc-overlay-light"&gt;&lt;/div&gt;
		&lt;/div&gt;
		&lt;div class="fc-back"&gt;
			&lt;div&gt;&lt;img src="images/5.jpg"&gt;&lt;h3&gt;Soft&lt;/h3&gt;&lt;/div&gt;
			&lt;div class="fc-overlay-dark"&gt;&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	
&lt;/div&gt;
</pre>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<p>The nav element has some empty spans that serve as &#8220;detection areas&#8221;. Each side of the circle has three areas that will be clickable, one at the top, one in the middle and one at the bottom. The i element will serve as a navigation arrow and depending on which span we are hovering, we will rotate the little arrow box to the right place. But we won&#8217;t use the arrow as the clickable area but the whole span.</p>
<p>The division for the circle flip contains a special 3D structure: it has a front and a back side. Once we navigate to the next or previous item, we will show that structure and rotate the flip container so that we see the back side.</p>
<p>The overlays make everything look a bit more realistic by providing light or darkness. We animate the opacity depending on the angle of rotation. </p>
<p>We simply call the plugin like this:</p>
<pre class="brush:js">
$( '#fc-slideshow' ).flipshow();
</pre>
<p>And this are the options for the plugin: </p>
<pre class="brush:js">
// the options
$.Flipshow.defaults = {
	// default transition speed (ms)
	speed : 700,
	// default transition easing
	easing : 'cubic-bezier(.29,1.44,.86,1.06)'
};
</pre>
<p>Please note, that this is very experimental and will only work as intended in browsers that support CSS 3d transforms. For others there is a simple fallback that simply shows and hides the previous or next item.</p>
<p>We hope you find this little plugin inspiring!</p>
<p><a class="demo" href="http://tympanus.net/Development/CircleFlipSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Development/CircleFlipSlideshow/CircleFlipSlideshow.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2013/01/28/flipping-circle-slideshow/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Gamma Gallery: A Responsive Image Gallery Experiment</title>
		<link>http://tympanus.net/codrops/2012/11/06/gamma-gallery-a-responsive-image-gallery-experiment/</link>
		<comments>http://tympanus.net/codrops/2012/11/06/gamma-gallery-a-responsive-image-gallery-experiment/#comments</comments>
		<pubDate>Tue, 06 Nov 2012 17:19:13 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Playground]]></category>
		<category><![CDATA[fluid]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[image gallery]]></category>
		<category><![CDATA[masonry]]></category>
		<category><![CDATA[responsive]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=11836</guid>
		<description><![CDATA[Gamma Gallery is an experimental responsive image gallery that attempts to provide an adjustable responsive images approach taking its grid layout and the full slideshow view into account. ]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/GammaGallery/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/GammaGallery.jpg" alt="Gamma Gallery: A Responsive Image Gallery Experiment" title="Gamma Gallery: A Responsive Image Gallery Experiment" width="580" height="315" class="alignnone size-full wp-image-11847" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/GammaGallery/">View demo</a> <a class="download" href="http://tympanus.net/Development/GammaGallery/GammaGallery.zip">Download source</a></p>
<p>Creating a truly responsive image gallery can be a very tricky and difficult thing. There are so many factors to consider like the layout and the features, and so many choices to make when it comes to delivering a good viewing experience for every device. Gamma Gallery is an attempt to create an image gallery that uses a similar responsive images approach to the <a href="http://www.w3.org/community/respimg/wiki/Picture_Element_Proposal">proposed picture element</a>. Focused on providing suitable image sizes for both, the fluid grid thumbnails and the full image view, the selection of images also depends on container dimensions and not solely on the window size. In some cases it might even be reasonable to load larger thumbnails for a smaller device if we, for example want to show less columns in a grid. So, smaller windows don&#8217;t necessarily mean smaller thumbnails.</p>
<p>Gamma Gallery uses David David DeSandro&#8217;s <a href="http://masonry.desandro.com/">Masonry</a> in a fluid mode where column numbers are defined depending on the grid container sizes. </p>
<p>Inspired by <a href="https://github.com/scottjehl/picturefill">Picturefill</a> from Scott Jehl, the responsive images approach that mimics the picture element, we&#8217;ve come up with the following HTML structure for defining different image sizes:</p>
<pre class="brush:html">
&lt;div class="gamma-container gamma-loading" id="gamma-container"&gt;

	&lt;ul class="gamma-gallery"&gt;
		&lt;li&gt;
			&lt;div data-alt="img01" data-description="&lt;h3&gt;Assemblage&lt;/h3&gt;" data-max-width="1800" data-max-height="2400"&gt;
				&lt;div data-src="images/xxxlarge/1.jpg" data-min-width="1300"&gt;&lt;/div&gt;
				&lt;div data-src="images/xxlarge/1.jpg" data-min-width="1000"&gt;&lt;/div&gt;
				&lt;div data-src="images/xlarge/1.jpg" data-min-width="700"&gt;&lt;/div&gt;
				&lt;div data-src="images/large/1.jpg" data-min-width="300"&gt;&lt;/div&gt;
				&lt;div data-src="images/medium/1.jpg" data-min-width="200"&gt;&lt;/div&gt;
				&lt;div data-src="images/small/1.jpg" data-min-width="140"&gt;&lt;/div&gt;
				&lt;div data-src="images/xsmall/1.jpg"&gt;&lt;/div&gt;
				&lt;noscript&gt;
					&lt;img src="images/xsmall/1.jpg" alt="img01"/&gt;
				&lt;/noscript&gt;
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt; &lt;!-- ... --&gt; &lt;/li&gt;
		&lt;!-- ... --&gt;
	&lt;/ul&gt;

	&lt;div class="gamma-overlay"&gt;&lt;/div&gt;

&lt;/div&gt;
</pre>
<p>Depending in which viewing mode we are, thumbnail grid view or full image view, the choice of the fitting image will depend on either the list item&#8217;s size or the whole viewport size. Let&#8217;s call that the &#8220;container size&#8221;. An &#8220;xsmall&#8221; image will be chosen if the container size is less than 140 pixels. A &#8220;small&#8221; image is picked if the container is wider than 140 pixels (data-min-width=&#8221;140&#8243;). A &#8220;medium&#8221; image is chosen if the container is wider than 200 pixels and so on. </p>
<p>Because we have a &#8220;fluid&#8221; image approach where we define the max-width of the image to be 100%, we will fit the image in its container if the image is bigger than the container. For that, our images will have the sizes that are defined in their consecutive (upper) step. For example, the &#8220;large&#8221; sized image will have a width of 700 pixels. This will ensure that the image shown is always equal or larger than its container, never smaller. In order to maintain the layout of the grid and never show a pixelated image (i.e. by stretching it), this approach seemed the most reasonable one. </p>
<p>The data-max-width and data-max-height attributes defines the largest image dimension which will restrict it to that size and not stretch it fully in the slideshow view. The slideshow view will take all the window size into account and allow the image to fill up all the possible space. The attributes ensure that the image doesn&#8217;t get resized beyond its largest dimension and become pixelated on huge screens. </p>
<p>Some things we are using in Gamma:</p>
<ul>
<li><a href="http://masonry.desandro.com/">jQuery Masonry</a> by David DeSandro for the grid layout</li>
<li><a href="http://www.w3.org/TR/page-visibility/">PageVisibility API</a> for pausing the slideshow when the page is not being displayed (e.g. when changing the tab). Also read <a href="http://www.html5rocks.com/en/tutorials/pagevisibility/intro/">Using the PageVisibility API</a> by Joe Marini on HTML5 Rocks</li>
<li><a href="https://github.com/websanova/js-url">url()</a>: a simple, lightweight url parser for JavaScript</li>
<li><a href="https://github.com/balupton/history.js">History.js</a> for HTML5 History/State APIs (pushState, replaceState, onPopState) support</li>
<li><a href="http://jquerypp.com/">jQuery++</a> for some useful DOM helpers and special events</li>
<li>And of course, <a href="http://modernizr.com/">Modernizr</a></li>
</ul>
<p><strong>There are many things to improve here, it is a very experimental implementation that tries to tackle the responsiveness of a special scenario, an image gallery.</strong></p>
<p>In the demo we don&#8217;t really take care of the vertical images which should of course have a set of reasonable dimensions that take the height of common screen sizes into account. </p>
<p>Here are the settings in the Gamma gallery script:</p>
<pre class="brush:js">
// default value for masonry column count
columns : 4,
// transition properties for the images in ms (transition to/from singleview)
speed : 300,
easing : 'ease',
// if set to true the overlay's opacity will animate (transition to/from singleview)
overlayAnimated : true,
// if true, the navigate next function is called when the image (singleview) is clicked
nextOnClickImage : true,
// circular navigation
circular : true,
// transition settings for the image in the single view.
// These include:
// - adjusting its position and size when the window is resized
// - fading out the image when navigating
svImageTransitionSpeedFade : 300,
svImageTransitionEasingFade : 'ease-in-out',
svImageTransitionSpeedResize : 300,
svImageTransitionEasingResize : 'ease-in-out',
svMarginsVH : {
	vertical : 140,
	horizontal : 120
},
// allow keybord and swipe navigation
keyboard : true,
swipe : true,
// slideshow interval (ms)
interval : 4000,
// if History API is not supported this value will turn false
historyapi : true
</pre>
<p>And here is an example of how we can initialize the gallery:</p>
<pre class="brush:js">
&lt;script type="text/javascript"&gt;
	
	$(function() {

		var GammaSettings = {
				// order is important!
				viewport : [ {
					width : 1200,
					columns : 5
				}, {
					width : 900,
					columns : 4
				}, {
					width : 500,
					columns : 3
				}, { 
					width : 320,
					columns : 2
				}, { 
					width : 0,
					columns : 2
				} ]
		};

		Gamma.init( GammaSettings );

	});

&lt;/script&gt;
</pre>
<p>The viewport width is the width that we will take into account for choosing the right sized image but also for defining how many columns in our grid layout we want to show. For example, between 320 and 500 pixel we would like to show 2 columns. </p>
<p>The images used in the demo are by <a href="http://www.idleformat.com/">Idleformat</a>.</p>
<p>The thumbnail hover style is inspired by the one seen on <a href="http://studionudge.com/">Nudge</a>.</p>
<p>Feedback, suggestions and comment are very welcome, there is lot&#8217;s things to improve and make better. Thank you!</p>
<div class="ct-github-link"><a href="https://github.com/codrops/GammaGallery">Find this project on Github</a></div>
<p><a class="demo" href="http://tympanus.net/Development/GammaGallery/">View demo</a> <a class="download" href="http://tympanus.net/Development/GammaGallery/GammaGallery.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/11/06/gamma-gallery-a-responsive-image-gallery-experiment/feed/</wfw:commentRss>
		<slash:comments>103</slash:comments>
		</item>
		<item>
		<title>Slit Slider Revised</title>
		<link>http://tympanus.net/codrops/2012/10/24/slit-slider-revised/</link>
		<comments>http://tympanus.net/codrops/2012/10/24/slit-slider-revised/#comments</comments>
		<pubDate>Wed, 24 Oct 2012 17:56:08 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[News & Updates]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=11631</guid>
		<description><![CDATA[Slit Slider is a slideshow with a twist: when navigating the slides, the current one will be "cut open" into two slices and moved away, revealing the next or previous slide. The slider can be used in a responsive context and it has been updated and improved.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/FullscreenSlitSlider/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/SlitSlider.jpg" alt="Slit Slider Revised" title="Slit Slider Revised" width="580" height="315" class="alignnone size-full wp-image-11636" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FullscreenSlitSlider/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/FullscreenSlitSlider/FullscreenSlitSlider.zip">Download source</a></p>
<p>We have updated the <strong><a href="http://tympanus.net/codrops/2012/06/05/fullscreen-slit-slider-with-jquery-and-css3/" title="Fullscreen Slit Slider with jQuery and CSS3" target="_blank">Slit Slider tutorial</a></strong>, fixed some issues and made the slider responsive. <strong>Check out the <a href="http://tympanus.net/codrops/2012/06/05/fullscreen-slit-slider-with-jquery-and-css3/" title="Fullscreen Slit Slider with jQuery and CSS3" target="_blank">original tutorial</a> to find out more about it and how to use it</strong>. </p>
<h3>Demos</h3>
<p>We&#8217;ve improved the original demo and because of some requests we&#8217;ve added another one which shows how the slider can be used in full width, fixed height and background images. Both of them are responsive:</p>
<ul>
<li><strong><a href="http://tympanus.net/Tutorials/FullscreenSlitSlider/index.html">Demo 1: Fullscreen with different background colors, dot navigation and arrow navigation</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/FullscreenSlitSlider/index2.html">Demo 2: Full width with background images</a></strong></li>
</ul>
<p><a href="http://tympanus.net/Tutorials/FullscreenSlitSlider/index2.html" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/SlitSlider_demo2.jpg" alt="SlitSlider_demo2" title="" width="750" height="367" class="alignnone size-full wp-image-11633" /></a></p>
<div class="ct-github-link"><a href="https://github.com/codrops/SlitSlider">Find this project on Github</a></div>
<h3>Summary of Changes</h3>
<p>A lot of changes were integrated into the new Slit Slider, here are the most important ones:</p>
<ul>
<li>The slider can now be used in a responsive context, simply set the wrapper&#8217;s width to a percentage and it will adapt.</li>
<li>The Transit plugin was removed.</li>
<li>We&#8217;ve added public methods for navigation control: next, previous and specific slide. This will make it possible to use custom controls.</li>
<li>Keyboard navigation has been added (right and left arrow keys).</li>
<li>The Firefox bug has been fixed.</li>
<li>We&#8217;ve added callback functions for before and after each slide transition.</li>
<li>New method for dynamically adding new slides.</li>
<li>Some other bug fixes, like flickering etc.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/10/24/slit-slider-revised/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>Slicebox Revised</title>
		<link>http://tympanus.net/codrops/2012/10/22/slicebox-revised/</link>
		<comments>http://tympanus.net/codrops/2012/10/22/slicebox-revised/#comments</comments>
		<pubDate>Mon, 22 Oct 2012 15:47:59 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[News & Updates]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slicebox]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=11563</guid>
		<description><![CDATA[Slicebox, the jQuery 3D image slider plugin, has been updated. We've done some major improvements and added new features.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/Slicebox/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/Slicebox_Updated.jpg" alt="Slicebox Revised" title="Slicebox Revised" width="580" height="315" class="alignnone size-full wp-image-11564" /></a><br />
<a class="demo" href="http://tympanus.net/Development/Slicebox/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Development/Slicebox/Slicebox.zip">Download source</a></p>
<div class="ct-announcement">Welcome to the <strong>News &amp; Updates section on Codrops</strong> where we will be announcing updates of older scripts and tutorials with improvements and suggestions you have sent to us or left in the comments. We will also add these updated scripts to <a href="https://github.com/codrops" target="_blank">GitHub</a>.</div>
<p><a href="http://tympanus.net/codrops/2011/09/05/slicebox-3d-image-slider/" title="Slicebox – A fresh 3D image slider with graceful fallback">Slicebox – A fresh 3D image slider with graceful fallback</a> has been updated! There are some new features and improvements that you have asked for and the project is now added to GitHub. <strong>Check out the <a href="http://tympanus.net/codrops/2011/09/05/slicebox-3d-image-slider/" title="Slicebox – A fresh 3D image slider with graceful fallback" target="_blank">original article</a> to find out how to use it and <a href="http://tympanus.net/Development/Slicebox/" title="Slicebox demo" target="_blank">view the demo</a></strong>.</p>
<div class="ct-github-link"><a href="https://github.com/codrops/Slicebox">Find this project on Github</a></div>
<h3>Summary of Changes</h3>
<p>A lot of changes were integrated into the new Slicebox, here are the most important ones:</p>
<ul>
<li>Slicebox is now responsive.</li>
<li>The images can now be wrapped into an anchor. You can also leave the image without an anchor around or have a mix of both cases (see the original <a href="http://tympanus.net/codrops/2011/09/05/slicebox-3d-image-slider/" title="Slicebox – A fresh 3D image slider with graceful fallback" target="_blank">original article</a> for more details on the structure).</li>
<li>The description is not taken from the title attribute of the image any more. There is a separate container for that and you can add any markup.</li>
<li>The description is now always shown.</li>
<li>It&#8217;s now possible to jump to any slide with a new method.</li>
<li>You can randomize the orientation and the number of slices.</li>
<li>Support for Firefox added</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/10/22/slicebox-revised/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Fullscreen Video Slideshow with BigVideo.js</title>
		<link>http://tympanus.net/codrops/2012/09/19/fullscreen-video-slideshow-with-bigvideo-js/</link>
		<comments>http://tympanus.net/codrops/2012/09/19/fullscreen-video-slideshow-with-bigvideo-js/#comments</comments>
		<pubDate>Wed, 19 Sep 2012 11:42:47 +0000</pubDate>
		<dc:creator>John Polacek</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=10956</guid>
		<description><![CDATA[A tutorial about how to create a slideshow-like fullscreen video background using BigVideo.js, a jQuery plugin for big background video.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/BigVideoSlideshow/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/09/BigVideoSlideshow.jpg" alt="Fullscreen Video Slideshow with BigVideo.js" title="Fullscreen Video Slideshow with BigVideo.js" width="580" height="315" class="alignnone size-full wp-image-10981" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/BigVideoSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/BigVideoSlideshow/BigVideoSlideshow.zip">Download source</a><br />
<strong>(Please note that the ZIP file does not contain any video files due to their size.)</strong></p>
<p><a href="http://dfcb.github.com/BigVideo.js/" target="_blank">BigVideo.js</a> is a jQuery plugin that makes it easy to create fit-to-fill background video on a web page. It can play silent ambient background video (or series of videos), or used as a player to show video playlist.</p>
<p>In this tutorial, we&#8217;ll be creating a page that shows a series of video screens, showcasing the free HD stock video footage and animated backgrounds available on <a href="http://beachfrontprod.blogspot.com/" target="_blank">Beachfront B-Roll</a>.</p>
<p>Before we get started, give some thought as to whether using this technique at all is appropriate for your project. Background video is bandwidth heavy and can be a big drag on the user&#8217;s browser performance. If your site is already video-heavy or incorporating big video is essential to the design and purpose of your site, then using this technique may be a great choice. However, if you can accomplish the same goal with using <a href="http://en.wikipedia.org/wiki/Cinemagraph" target="_blank">cinemagraphs</a> for example, maybe that is a better choice. This tutorial is can be helpful to you in either case, as we cover using big background images as well.</p>
<p>The first thing you&#8217;ll need to do is get video content. In this case, we went to <a href="http://beachfrontprod.blogspot.com/" target="_blank">Beachfront B-Roll</a> and downloaded a few of their free videos. Some of them were quite large in file size, so I used Quicktime Pro to trim them to about 10 seconds or so in length. For each of the videos, we will also need to create a poster image image of the first frame of the video. I used Photoshop to save a 960&#215;540 jpeg for each image. I used a trick of applying a .5 pixel blur and a quality setting of 50 to get a smaller file size (afterall, these are background images, so having a little blurriness on them is not a bad thing).</p>
<h3>The Markup</h3>
<p>First, let&#8217;s do the markup for the page:</p>
<p>We have a header on the center of the screen. Then we have a wrapper div that contains all the different video screens. Then, there is a button we will use to navigate between the screens.</p>
<pre class="brush:html">
&lt;header&gt;
    &lt;h1&gt;Fullscreen Video Slideshow &lt;span&gt;with BigVideo.js&lt;/span&gt;&lt;/h1&gt;
    &lt;p&gt;The videos in this demo are from &lt;a href="http://beachfrontprod.blogspot.com" target="_blank"&gt;Beachfront B-Roll&lt;/a&gt;, a great place to download unique HD stock video footage and animated backgrounds for any production purpose (for free!).&lt;/p&gt;
    &lt;p&gt;&lt;small&gt;A demo for&lt;/small&gt; &lt;a href="http://dfcb.github.com/BigVideo.js/" target="_blank"&gt;BigVideo.js&lt;/a&gt; &lt;small&gt;by &lt;a href="http://twitter.com/johnpolacek" target="_blank" rel="author"&gt;@johnpolacek&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
&lt;/header&gt;

&lt;div class="wrapper"&gt;
    &lt;div class="screen" id="screen-1" data-video="vid/bird.mp4"&gt;
        &lt;img src="img/bird.jpg" class="big-image" /&gt;
        &lt;h1 class="video-title"&gt;#1 Bird&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div class="screen" id="screen-2" data-video="vid/satellite.mp4"&gt;
        &lt;img src="img/satellite.jpg" class="big-image" /&gt;
        &lt;h1 class="video-title"&gt;#2 Satellite&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div class="screen" id="screen-3" data-video="vid/camera.mp4"&gt;
        &lt;img src="img/camera.jpg" class="big-image" /&gt;
        &lt;h1 class="video-title"&gt;#3 Camera&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div class="screen" id="screen-4" data-video="vid/spider.mp4"&gt;
        &lt;img src="img/spider.jpg" class="big-image" /&gt;
        &lt;h1 class="video-title"&gt;#4 Spider&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div class="screen" id="screen-5" data-video="vid/dandelion.mp4"&gt;
        &lt;img src="img/dandelion.jpg" class="big-image" /&gt;
        &lt;h1 class="video-title"&gt;#5 Dandelion&lt;/h1&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;nav id="next-btn"&gt;
    &lt;a href="#" class="next-icon"&gt;&lt;/a&gt;
&lt;/nav&gt;
</pre>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>The CSS</h3>
<p>Before we get into the video, we need to style the page.</p>
<p>Since navigation will be handled by a single big next button, we set the body overflow to hidden. While we&#8217;re at it, we&#8217;ll make all text on the page white.</p>
<pre class="brush:css">
html, body {
    margin: 0;
    padding: 0;
    color: #fff;
    overflow: hidden;
    font-family: 'Open Sans Condensed', Arial, sans-serif;
    font-weight: 300;
    font-size: 1em;
}
</pre>
<p>Next, for the wrapper, we know we have five content screens, so we set the width to 500% (100% per screen) and the height to 100%. We are going to navigate the page by animating the wrapper&#8217;s horizontal position, so it will use absolute positioning. We&#8217;ll use a z-index of zero to keep the wrapper content in the background.</p>
<p>Note the <strong>data-video</strong> attribute. This is where our script will grab the url for the video for each screen.</p>
<pre class="brush:css">
.wrapper {
    position: absolute;
    width: 500%;
    height: 100%;
    z-index: 0;
}
</pre>
<p>We&#8217;ll position the header in the center of the page and make. Also, give it a high z-index so it stays on top of our background content.</p>
<pre class="brush:css">
header {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 999;
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 60px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    margin: -200px 0 0 -200px;
    text-align: center;
}

</pre>
<p>We want each screen to fill the height and width of the screen, so we set the height to 100%, and the width to 100% divided by the number of screens, in this case this results in 20%. Let&#8217;s set them to float left and make the positioning relative so we can absolutely position content inside the screens. We center the position of the image inside the screen div, so we keep the overflow hidden.</p>
<pre class="brush:css">
.screen {
    position: relative;
    height: 100%; 
    width: 20%; /*  NOTE:numVideos/100%  */
    float: left;
    overflow: hidden;
}
</pre>
<p>Inside the screen divs, we have a large image of the first frame of the video and a video title. For the image, we use min-width, min-height to make sure the size of the image is never smaller than the size of the .screen container div (which is always the size of the browser window) and set height and width to auto so the image&#8217;s aspect ratio is maintained.</p>
<pre class="brush:css">
.big-image {
    min-width: 100%;
    min-height: 100%; 
    height: auto;
    width: auto; 
}
</pre>
<p>Let&#8217;s put the video titles in the bottom left, make the font size really big and have them be 50% transparent.</p>
<pre class="brush:css">
.video-title {
    position: absolute;
    bottom: 5%;
    left: 5%;
    opacity: .5;
    margin: 0;
    padding: 0;
    line-height: .65;
    font-size: 4em;
    text-transform: uppercase;
}
</pre>
<p>Next up, the arrow button. I&#8217;ve made a pure CSS arrow button using a technique of putting a box with a border top and left, then rotating that box 45 degrees and putting it inside a div with a large border-radius turning it into a circle. (Note: We will make the rotation work by applying an IE filter for rotating 45 degrees from Boog Design&#8217;s excellent <a href="http://www.boogdesign.com/examples/transforms/matrix-calculator.html" target="_blank">Matrix Calculator</a>. See the head of the HTML for the conditional comment.)</p>
<pre class="brush:css">
nav {
    position:absolute; 
    right: 5%; 
    top: 45%; 
    padding: 20px; 
    background: #000; 
    border-radius: 40px; 
    opacity: .4; 
    cursor: pointer;}
    nav: hover {
    opacity: .6;
}

.next-icon {
    display: block;
    border-top: solid 2px #fff; 
    border-right: solid 2px #fff; 
    width: 20px; 
    height: 20px;
    position: relative;
    left: -5px;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    color: #fff;
    text-decoration: none;
}
</pre>
<h3>The JavaScript</h3>
<p>Ok, here&#8217;s where we make stuff happen. First, link to all the scripts at the bottom of the page, before the closing body tag. Download the <a href="https://github.com/dfcb/BigVideo.js/zipball/master">BigVideo.js Github Repo</a>. In addition to BigVideo.js and its dependencies, we will be using <a href="http://ricostacruz.com/jquery.transit/" target="_blank">jQuery Transit</a> for animations.</p>
<pre class="brush:html">
&lt;!-- BigVideo Dependencies --&gt;
&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script&gt;window.jQuery || document.write('&lt;script src="js/jquery-1.7.2.min.js"&gt;&lt;\/script&gt;')&lt;/script&gt;
&lt;script src="js/jquery-ui-1.8.22.custom.min.js"&gt;&lt;/script&gt;
&lt;script src="js/jquery.imagesloaded.min.js"&gt;&lt;/script&gt;
&lt;script src="http://vjs.zencdn.net/c/video.js"&gt;&lt;/script&gt;

&lt;!-- BigVideo --&gt;
&lt;script src="js/bigvideo.js"&gt;&lt;/script&gt;

&lt;!-- Tutorial Demo --&gt;
&lt;script src="js/jquery.transit.min.js"&gt;&lt;/script&gt;
</pre>
<p>Before we get to the video, let&#8217;s set up navigation. We will need some vars to help manage navigation.</p>
<pre class="brush:js">
$(function() {
    var screenIndex = 1,
    numScreens = $('.screen').length,
    isTransitioning = false,
    transitionDur = 1000;
}
</pre>
<p>Let&#8217;s go over what these vars do.</p>
<ul>
<li>screenIndex &#8211; keeps track of what screen we are looking at</li>
<li>numScreens &#8211; the number of screens (in our case 5)</li>
<li>isTransition &#8211; boolean to prevent extra clicking interfering with the navigation</li>
<li>transitionDur &#8211; how fast the animation scrolls</li>
</ul>
<p>Now, add a next button click event and callback to do navigation.</p>
<pre class="brush:js">
$('#next-btn').on('click', function(e) {
    e.preventDefault();
    if (!isTransitioning) {
        next();
    }
});

function next() {
    isTransitioning = true;
    
    // update video index
    if (screenIndex === numScreens) {
        screenIndex = 1;
    } else {
        screenIndex++;
    }
    
    $('.wrapper').transit(
        {'left':'-'+(100*(screenIndex-1))+'%'},
        transitionDur,
        onTransitionComplete);
}

function onTransitionComplete() {
    isTransitioning = false;
}
</pre>
<p>Now, that our navigation is working, time to set up the video. When creating a video heavy site, it is important to consider mobile devices. Typically they do not support autoplay, meaning ambient background video will not work. There are tricks to get around this, but we should also consider that it is likely that the user is on a lower bandwidth connection. One thing to consider would be to provide non-video content to these users. In this demo, we will demonstrate how to do that using Modernizr, which you should link to in the document head.</p>
<p>First, add a var for BigVideo (BV) and an isTouch boolean to the top of our script, which gets set by Modernizr&#8217;s touch feature detection.</p>
<pre class="brush:js">
var screenIndex = 1,
    numScreens = $('.screen').length,
    isTransitioning = false,
    transitionDur = 1000,
    BV,
    isTouch = Modernizr.touch;
   </pre>
<p>Next, initialize BigVideo for non-touch devices. Create a showVideo() function where we will grab the video filepath from the data-video attribute for the current screen being viewed. Add a showVideo() call to the onTransitionComplete callback function. Also, when the video is loaded and ready to play, we need to fade the framegrab image out. To do that, we use the Video.js api to add a &#8216;loadeddata&#8217; event listener to the BigVideo player. We attach a callback function to that event which makes the image of the current screen fade out so the video is displayed.</p>
<pre class="brush:js">
var screenIndex = 1,
    numScreens = $('.screen').length,
    isTransitioning = false,
    transitionDur = 1000,
    BV,
    isTouch = Modernizr.touch;

// Next button click goes to next div
$('#next-btn').on('click', function(e) {
    e.preventDefault();
    if (!isTransitioning) {
        next();
    }
});

if (!isTouch) {
    // initialize BigVideo
    BV = new $.BigVideo({forceAutoplay:isTouch});
    BV.init();
    showVideo();
    
    BV.getPlayer().addEvent('loadeddata', function() {
        onVideoLoaded();
    });

    // adjust image positioning so it lines up with video
    $bigImage
        .css('position','relative')
        .imagesLoaded(adjustImagePositioning);
    // and on window resize
    $(window).on('resize', adjustImagePositioning);
}

// Next button click goes to next div
$('#next-btn').on('click', function(e) {
    e.preventDefault();
    if (!isTransitioning) {
        next();
    }
});

function showVideo() {
    BV.show($('#screen-'+screenIndex).attr('data-video'),{ambient:true});
}

function next() {
    isTransitioning = true;
    
    // update video index, reset image opacity if starting over
    if (screenIndex === numScreens) {
        $bigImage.css('opacity',1);
        screenIndex = 1;
    } else {
        screenIndex++;
    }
    
    if (!isTouch) {
        $('#big-video-wrap').transit({'left':'-100%'},transitionDur)
    }
        
    $('.wrapper').transit(
        {'left':'-'+(100*(screenIndex-1))+'%'},
        transitionDur,
        onTransitionComplete);
}

function onVideoLoaded() {
    $('#screen-'+screenIndex).find('.big-image').transit({'opacity':0},200)
}

function onTransitionComplete() {
    isTransitioning = false;
    if (!isTouch) {
        $('#big-video-wrap')
            .css('left',0);
        showVideo();
    }
}
</pre>
<h3>Tidying up</h3>
<p>You may notice that the big image and the big video don&#8217;t line up during the fade animation, resulting in a bothersome jump in position.This is because the video is centered inside the screen. To fix the problem, we need also need to center our images. To do that, we create a function that adjusts the positioning of the images.</p>
<pre class="brush:js">
function adjustImagePositioning() {
    $bigImage.each(function(){
        var $img = $(this),
            img = new Image();

        img.src = $img.attr('src');

        var windowWidth = $window.width(),
            windowHeight = $window.height(),
            r_w = windowHeight / windowWidth,
            i_w = img.width,
            i_h = img.height,
            r_i = i_h / i_w,
            new_w, new_h, new_left, new_top;

        if( r_w > r_i ) {
            new_h   = windowHeight;
            new_w   = windowHeight / r_i;
        }
        else {
            new_h   = windowWidth * r_i;
            new_w   = windowWidth;
        }

        $img.css({
            width   : new_w,
            height  : new_h,
            left    : ( windowWidth - new_w ) / 2,
            top     : ( windowHeight - new_h ) / 2
        })

    });

}
</pre>
<p>Call the function on document ready and attach it to a window resize event.</p>
<pre class="brush:js">
$bigImage
    .css('position','relative')
    .imagesLoaded(adjustImagePositioning);
// and on window resize
$(window).on('resize', adjustImagePositioning);
</pre>
<p>Now the images and videos should be aligned, resulting in a clean transition between the poster image and the video.</p>
<p><strong>Please note that the ZIP file does not contain any video files due to their size.</strong></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/BigVideoSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/BigVideoSlideshow/BigVideoSlideshow.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/09/19/fullscreen-video-slideshow-with-bigvideo-js/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>Image Accordion with CSS3</title>
		<link>http://tympanus.net/codrops/2012/06/06/image-accordion-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/06/06/image-accordion-with-css3/#comments</comments>
		<pubDate>Wed, 06 Jun 2012 17:44:41 +0000</pubDate>
		<dc:creator>Ring Wing</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[accordion]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=9322</guid>
		<description><![CDATA[In this tutorial we will create an image accordion that will expand an item on click. Using the sibling combinators and a nested structure we can control the opening of the items/slides with radio buttons.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3ImageAccordion/"><br />
<img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/AccordionSlideshow.jpg" alt="Image Accordion with CSS3" title="Image Accordion with CSS3" width="580" height="315" class="alignnone size-full wp-image-9384" /><br />
</a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3ImageAccordion/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3ImageAccordion/CSS3ImageAccordion.zip">Download source</a></p>
<p>Today we are going to create a CSS-only image accordion. We&#8217;ll use a nested structure and apply a technique of <strong>radio buttons</strong> and the <strong>sibling combinator</strong> in order to control the slides. The idea is to make each item, or slide, &#8220;clickable&#8221; by overlaying the radio button over the entire slide, and change the position of a child element when clicking on it.</p>
<p>The images used in the demo are from the &#8220;L&#8217;aquarelle&#8221; project by Andrey &amp; Lili: <a href="http://www.behance.net/gallery/Laquarelle/433242">L&#8217;aquarelle on Behance</a>. It is licensed under the <a href="http://creativecommons.org/licenses/by-nc/3.0/" title="CC BY-NC 3.0">Creative Commons Attribution-NonCommercial 3.0 Unported License</a> .</p>
<div class="ct-special-box"><strong>Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties.</strong></div>
<h3>The Markup</h3>
<p>The main idea is to create a nested structure that will allow us to simply move the respective accordion slides to one side, i.e. moving one slide will move all its inner slides (the nested elements). Each of the figures will have the image, a radio button for controlling the &#8220;opening&#8221; of a slide, and a caption. </p>
<pre class="brush:html">
&lt;div class="ia-container"&gt;
				
	&lt;figure&gt;
		&lt;img src="images/1.jpg" alt="image01" /&gt;
		&lt;input type="radio" name="radio-set" checked="checked" /&gt;
		&lt;figcaption&gt;&lt;span&gt;True Colors&lt;/span&gt;&lt;/figcaption&gt;
		
		&lt;figure&gt;
			&lt;img src="images/2.jpg" alt="image02" /&gt;
			&lt;input type="radio" name="radio-set" /&gt;
			&lt;figcaption&gt;&lt;span&gt;Honest Light&lt;/span&gt;&lt;/figcaption&gt;
			
			&lt;figure&gt;
				&lt;!-- ... --&gt;
				
				&lt;figure&gt;
					&lt;!-- ... --&gt;
					
					&lt;figure&gt;
						&lt;!-- ... --&gt;
						
						&lt;figure&gt;
							&lt;!-- ... --&gt;
				
							&lt;figure&gt;
								&lt;!-- ... --&gt;										

								&lt;figure&gt;
									&lt;!-- ... --&gt;
								&lt;/figure&gt;
								
							&lt;/figure&gt;
				
						&lt;/figure&gt;	
							
					&lt;/figure&gt;	
						
				&lt;/figure&gt;
					
			&lt;/figure&gt;
			
		&lt;/figure&gt;
		
	&lt;/figure&gt;
	
&lt;/div&gt;
</pre>
<p>You could also use different kind of content here, what is important is the nested structure and the radio input.<br />
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div></p>
<h3>The CSS</h3>
<p>We&#8217;ll give the slider a width value and hide the excess part with overflow hidden. </p>
<pre class="brush:css">
.ia-container {
	width: 685px;
	margin: 20px auto;
	overflow: hidden;
	box-shadow: 1px 1px 4px rgba(0,0,0,0.08);
	border: 7px solid rgba(255,255,255,0.6);
}
</pre>
<p>The width is calculated as follows: </p>
<pre>( (Number of images - 1) * 50px ) + 335px</pre>
<p>where 50 is the width of the visible piece of an image and 335 is the width of the image. In our case, that gives us <em>( (8 &#8211; 1) * 50px ) + 335px = 350px + 335px = 685px</em>.</p>
<p>Each of the figures will have a left value of 50 pixel (visible piece). That should be their position relatively to their parent. This makes the slider look like an accordion. The width of a figure is 335 pixel, just like the image inside. The figure will also have a transition for a smooth movement:</p>
<pre class="brush:css">
.ia-container figure {
    position: absolute;
	top: 0;
	left: 50px; /* width of visible piece */
	width: 335px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
    transition: all 0.3s ease-in-out;
}
</pre>
<p>The first figure will be positioned completely to the left and we set the <em>!important</em> because we will use media queries later and we always want the left to be 0 for this figure. The position will be set to &#8220;relative&#8221; in order to give the slider a height:</p>
<pre class="brush:css">
.ia-container > figure {
    position: relative;
	left: 0 !important;
}
</pre>
<p>The image will have a width of 100% so that it fills the figure:</p>
<pre class="brush:css">
.ia-container img {
	display: block;
	width: 100%;
}
</pre>
<p>Each of the radio buttons will cover the visible part of a slide. We set the opacity to 0 so that we can&#8217;t see it but still be able to click it. The z-index should be high, so that it covers everything else:</p>
<pre class="brush:css">
.ia-container input {
	position: absolute;
	top: 0;
	left: 0;
	width: 50px; /* just cover visible part */
	height: 100%;
	cursor: pointer;
	border: 0;
	padding: 0;
    opacity: 0;
	z-index: 100;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

</pre>
<p>When an input is selected or clicked, we want the input to disappear. Actually, we could say something like <em>width: 0px</em> but because of some kind of strange behavior in the Chrome browser we still need it at the right side (the next item won&#8217;t trigger the hover if we haven&#8217;t hovered over the current input). We also want the sibling figures to move to the left with a transition:</p>
<pre class="brush:css">
.ia-container input:checked{
	width: 5px;
	left: auto;
	right: 0px;
}
.ia-container input:checked ~ figure {
    left: 335px;
    transition: all 0.7s ease-in-out;
}
</pre>
<p>Giving two different transition durations (one in the &#8220;default&#8221; state, one when we check an input) will give us the &#8220;shuffle&#8221; effect. Playing with these values will give you different effects.</p>
<p>The caption of the figure will cover all the element with a transparent dark overlay and the span will be positioned over the upper half of the figure initially:</p>
<pre class="brush:css">
.ia-container figcaption {
	width: 100%;
	height: 100%;
	background: rgba(87, 73, 81, 0.1);
	position: absolute;
	top: 0px;
    transition: all 0.2s linear;
}

.ia-container figcaption span {
	position: absolute;
	top: 40%;
	margin-top: -30px;
	right: 20px;
	left: 20px;
	overflow: hidden;
	text-align: center;
	background: rgba(87, 73, 81, 0.3);
	line-height: 20px;
	font-size: 18px;
    opacity: 0;
	text-transform: uppercase;
	letter-spacing: 4px;
	font-weight: 700;
	padding: 20px;
	color: #fff;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
} 
</pre>
<p>When a slide gets selected, we will remove the overlay by setting the opacity value of the RGBA to 0:</p>
<pre class="brush:css">
.ia-container input:checked + figcaption,
.ia-container input:checked:hover + figcaption{
	background: rgba(87, 73, 81, 0);
}
</pre>
<p>The span will fade in and move from the top with a delay (the slide should open first):</p>
<pre class="brush:css">
.ia-container input:checked + figcaption span {
    transition: all 0.4s ease-in-out 0.5s;
	opacity: 1;
	top: 50%;
}
</pre>
<p>Since the last slide does not have any other slides coming from the right when we select it, the delay does not need to be as high (we&#8217;ve given the last radio input an id <strong>ia-selector-last</strong>):</p>
<pre class="brush:css">
.ia-container #ia-selector-last:checked + figcaption span {
	transition-delay: 0.3s;
}
</pre>
<p>When we hover over the visible piece of a closed slide, we want a slight hover effect. But because the radio input is covering this part (it&#8217;s on top of all the other elements) we will use the adjacent sibling combinator (this requires that the input is directly followed by the figcaption element):  </p>
<pre class="brush:css">
.ia-container input:hover + figcaption {
	background: rgba(87, 73, 81, 0.03);
}
</pre>
<p>All the following siblings of a checked input should get a low z-index, again to prevent some unwanted behavior in Chrome:</p>
<pre class="brush:css">
.ia-container input:checked ~ figure input{
    z-index: 1;
}
</pre>
<p>And finally, we&#8217;ll add some media queries to make the slider responsive:</p>
<pre class="brush:css">
@media screen and (max-width: 720px) {
    .ia-container { 
		width: 540px; 
	}
	
	.ia-container figure { 
		left: 40px; 
		width: 260px; 
	}
	
	.ia-container input { 
		width: 40px; 
	}
	
	.ia-container input:checked ~ figure { 
		left: 260px; 
	}
	
	.ia-container figcaption span { 
		font-size: 16px; 
	}
}

@media screen and (max-width: 520px) {
    .ia-container { 
		width: 320px; 
	}
	
	.ia-container figure { 
		left: 20px; 
		width: 180px; 
	}
	
	.ia-container input { 
		width: 20px; 
	}
	
	.ia-container input:checked ~ figure { 
		left: 180px; 
	}
	
	.ia-container figcaption span { 
		font-size: 12px; 
		letter-spacing: 2px; 
		padding: 10px; 
		margin-top: -20px; 
	} 

}

</pre>
<p>That&#8217;s all, hope you like it!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3ImageAccordion/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3ImageAccordion/CSS3ImageAccordion.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/06/06/image-accordion-with-css3/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Fullscreen Slit Slider with jQuery and CSS3</title>
		<link>http://tympanus.net/codrops/2012/06/05/fullscreen-slit-slider-with-jquery-and-css3/</link>
		<comments>http://tympanus.net/codrops/2012/06/05/fullscreen-slit-slider-with-jquery-and-css3/#comments</comments>
		<pubDate>Tue, 05 Jun 2012 16:00:34 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=9357</guid>
		<description><![CDATA[A tutorial on how to create a fullscreen slideshow with a twist: the idea is to slice open the current slide when navigating to the next or previous one. Using jQuery and CSS animations we can create unique slide transitions for the content elements.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/FullscreenSlitSlider/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/SlitSlider.jpg" alt="Fullscreen Slit Slider with jQuery and CSS3" title="Fullscreen Slit Slider with jQuery and CSS3" width="580" height="315" class="alignnone size-full wp-image-9377" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FullscreenSlitSlider/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/FullscreenSlitSlider/FullscreenSlitSlider.zip">Download source</a></p>
<p>In this tutorial we&#8217;ll create a fullscreen slideshow with a twist: we&#8217;ll slice the current slide open in order to reveal the next or previous slide. Using different data-attributes, we&#8217;ll define the type, rotation angle and scale of a slide&#8217;s parts, giving us the possibility to create unique effects of each slide transition.</p>
<p>We&#8217;ll be using <a href="http://benalman.com/projects/jquery-cond-plugin/">jQuery cond</a>, jQuery plugin by Ben Alman for chainable &#8220;if-then-else&#8221; statements.</p>
<p>The animal icon font that we&#8217;ll be using is by Alan Carr and you can find it <a href="http://www.dafont.com/animals.font">here</a>.</p>
<p>The images in the second demo are by <a href="http://www.flickr.com/photos/majownik/">Majownik</a> and they are licensed under a <a href="http://creativecommons.org/licenses/by/2.0/deed.en">Creative Commons Attribution License</a>. </p>
<div class="ct-special-box"><strong>Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties.</strong></div>
<p>Let&#8217;s start with the HTML.</p>
<h3>The Markup</h3>
<p>Our initial markup will consist of a main container with the class and id <strong>sl-slide-wrapper</strong> which will hold the slider and all the slides, each one having the class <strong>sl-slide</strong>. Then, we will add two types of navigation, one will be the arrows to go to the previous and next slide and the other will be the dots for navigating directly to a certain slide. We&#8217;ll also add a background class to each slide which will control the background color of every slide.</p>
<pre class="brush:xml">
&lt;div id="slider" class="sl-slider-wrapper"&gt;

	&lt;div class="sl-slider"&gt;
	
		&lt;div class="sl-slide bg-1"&gt;
			&lt;div class="sl-slide-inner"&gt;
				&lt;div class="deco" data-icon="H"&gt;&lt;/div&gt;
				&lt;h2&gt;A bene placito&lt;/h2&gt;
				&lt;blockquote&gt;
					&lt;p&gt;You have just dined...&lt;/p&gt;
					&lt;cite&gt;Ralph Waldo Emerson&lt;/cite&gt;
				&lt;/blockquote&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		
		&lt;div class="sl-slide bg-2"&gt;
			&lt;div class="sl-slide-inner"&gt;
				&lt;div class="deco" data-icon="q"&gt;&lt;/div&gt;
				&lt;h2&gt;Regula aurea&lt;/h2&gt;
				&lt;blockquote&gt;
					&lt;p&gt;Until he extends the circle...&lt;/p&gt;
					&lt;cite&gt;Albert Schweitzer&lt;/cite&gt;
				&lt;/blockquote&gt;
			&lt;/div&gt;
		&lt;/div&gt;

		&lt;div class="sl-slide bg-2"&gt;
			&lt;!-- ... --&gt;
		&lt;/div&gt;

		&lt;!-- ... --&gt;

	&lt;/div&gt;

	&lt;nav id="nav-arrows" class="nav-arrows"&gt;
		&lt;span class="nav-arrow-prev"&gt;Previous&lt;/span&gt;
		&lt;span class="nav-arrow-next"&gt;Next&lt;/span&gt;
	&lt;/nav&gt;

	&lt;nav id="nav-dots" class="nav-dots"&gt;
		&lt;span class="nav-dot-current"&gt;&lt;/span&gt;
		&lt;span&gt;&lt;/span&gt;
		&lt;span&gt;&lt;/span&gt;
		&lt;span&gt;&lt;/span&gt;
		&lt;span&gt;&lt;/span&gt;
	&lt;/nav&gt;

&lt;/div&gt;
</pre>
<p>Every slide will also have some data-attributes that we will use in order to control the effect for each slide. The data attributes that we want are the following:</p>
<pre class="brush:xml">
data-orientation
data-slice1-rotation
data-slice2-rotation
data-slice1-scale 
data-slice2-scale
</pre>
<p>The first one, <em>data-orientation</em> should be either &#8220;vertical&#8221; or &#8220;horizontal&#8221;. This we need in order to know where to &#8220;slice&#8221; the slide. It will be either slice horizontally or vertically. The <em>data-slice1-rotation</em> and <em>data-slice2-rotation</em> value will be the rotation degree for each one of the slices and the <em>data-slice1-scale</em> and <em>data-slice2-scale</em> value will be the scale value.</p>
<p>So, our first slide will have something like this:</p>
<pre class="brush:xml">
&lt;div class="sl-slide" data-orientation="horizontal" data-slice1-rotation="-25" data-slice2-rotation="-25" data-slice1-scale="2" data-slice2-scale="2"&gt;
</pre>
<p>Our structure is a &#8220;base structure&#8221;. We will build upon that structure using JavaScript in order to be able to create the effects. So, we will want to transform it into this (each slide will also have the data attributes):</p>
<pre class="brush:xml">
&lt;div id="slider" class="sl-slider-wrapper"&gt;

	&lt;div class="sl-slider"&gt;
			
		&lt;div class="sl-slides-wrapper"&gt;
		
			&lt;div class="sl-slide bg-1 sl-slide-horizontal"&gt;
				&lt;div class="sl-content-wrapper"&gt;
					&lt;div class="sl-content"&gt;
						&lt;!-- the content --&gt;
					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
			
			&lt;!-- ... --&gt;
			
		&lt;/div&gt;

	&lt;/div&gt;

	&lt;!-- navs --&gt;
		
&lt;/div&gt;
</pre>
<p>The content will basically be our &#8220;sl-slide-inner&#8221; and everything that is inside of it.</p>
<p>In the moment that we navigate to the next or previous slide we will take the current slide and duplicate its content wrapper, creating the &#8220;slices&#8221;:</p>
<pre class="brush:xml">
&lt;div class="sl-slide sl-slide-horizontal" &gt;

	&lt;div class="sl-content-slice"&gt;
		&lt;div class="sl-content-wrapper"&gt;
			&lt;div class="sl-content"&gt;
				&lt;!-- ... --&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	
	&lt;div class="sl-content-slice"&gt;
		&lt;div class="sl-content-wrapper"&gt;
			&lt;div class="sl-content"&gt;
				&lt;!-- ... --&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	
&lt;/div&gt;
					
</pre>
<p>Now, let&#8217;s style it!</p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>The CSS</h3>
<p><em>Note, that we will omit vendor prefixes here. </em></p>
<p>Since we will make a reusable plugin out of this we don&#8217;t want the slider to be fullscreen by default. So, we won&#8217;t set the default style of the wrapper to 100% width and height but to this:</p>
<pre class="brush:css">
.sl-slider-wrapper {
	width: 800px;
	height: 400px;
	margin: 0 auto;
	position: relative;
	overflow: hidden;
}
</pre>
<p>The slider will be of position absolute and we&#8217;ll set the top and left to zero. The width and height will be set dynamically with JavaScript.<br />
The slides, the dyamic wrapper and the inner part will all need absolute positioning and they&#8217;ll have a width and height of 100%:</p>
<pre class="brush:css">

.sl-slider {
	position: absolute;
	top: 0;
	left: 0;
}

.sl-slide,
.sl-slides-wrapper,
.sl-slide-inner {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
} 

</pre>
<p>Each slide should have a z-index of 1; we&#8217;ll control the appearance and the stacking of the slides with JavaScript:</p>
<pre class="brush:css">
.sl-slide {
	z-index: 1;
}
</pre>
<p>The content &#8220;slices&#8221; will be positioned absolutely and their common style is the following:</p>
<pre class="brush:css">
/* The duplicate parts/slices */

.sl-content-slice {
	overflow: hidden;
	position: absolute;
	box-sizing: content-box;
	background: #fff;
}
</pre>
<p>We use <em>box-sizing: content-box</em> here because by default we use <em>border-box</em> .</p>
<p>The content &#8220;slices&#8221; will be horizontal or vertical, meaning that either the height or the width will be half of the screensize. In order to avoid seeing the edges of a slice when we rotate it, we&#8217;ll add some paddings. </p>
<pre class="brush:css">
/* Horizontal slice */

.sl-slide-horizontal .sl-content-slice {
	width: 100%;
	height: 50%;
	left: -200px;
}

.sl-slide-horizontal .sl-content-slice:first-child {
	top: -200px;
	padding: 200px 200px 0px 200px;
}

.sl-slide-horizontal .sl-content-slice:nth-child(2) {
	top: 50%;
	padding: 0px 200px 200px 200px;
}

/* Vertical slice */

.sl-slide-vertical .sl-content-slice {
	width: 50%;
	height: 100%;
	top: -200px;
}

.sl-slide-vertical .sl-content-slice:first-child {
	left: -200px;
	padding: 200px 0px 200px 200px;
}

.sl-slide-vertical .sl-content-slice:nth-child(2) {
	left: 50%;
	padding: 200px 200px 200px 0px;
}
</pre>
<p>We use negative position values in order to &#8220;pull&#8221; the divisions into place.</p>
<p>Let&#8217;s style the content wrapper and the content division:</p>
<pre class="brush:css">
/* Content wrapper */
/* Width and height is set dynamically */

.sl-content-wrapper {
	position: absolute;
}

.sl-content {
	width: 100%;
	height: 100%;
	background: #fff;
}

</pre>
<p>The division with the class <strong>sl-content-wrapper</strong> will get a height and width dynamically. If, for example, the slide is horizontal, the wrapper will have a width of 100% of the parent&#8217;s container width and 50% of the parent&#8217;s container height. The wrapper of the second slice will also have a negative top (horizontal) or left (vertical) margin in order to &#8220;pull&#8221; the duplicated content up or to the left. </p>
<p>This is all the styling for the slider to work by default. Let&#8217;s take a look at some custom elements, like the nav items and the content elements that we&#8217;ll animate when we navigate through the slides.</p>
<p>For the navigation arrows we will use this image-less technique. We&#8217;ll simply have a little box and rotate it 45 degrees. Then we&#8217;ll add some border to the sides and voilà, we made ourselves some neat arrows:</p>
<pre class="brush:css">
/* Custom navigation arrows */

.nav-arrows span {
	position: absolute;
	z-index: 2000;
	top: 50%;
	width: 40px;
	height: 40px;
	border: 8px solid #ddd;
	border: 8px solid rgba(150,150,150,0.4);
	text-indent: -90000px;
	margin-top: -40px;
	cursor: pointer;
	transform: rotate(45deg);
}

.nav-arrows span:hover {
	border-color: rgba(150,150,150,0.9);
}

.nav-arrows span.nav-arrow-prev {
	left: 5%;
	border-right: none;
	border-top: none;
}

.nav-arrows span.nav-arrow-next {
	right: 5%;
	border-left: none;
	border-bottom: none;
}

</pre>
<p>Now, let&#8217;s style the navigation dots. We&#8217;ll position them absolutely and make the span display as inline-blocks so that we can somply center them. They will look like little dots because we&#8217;ll apply a border radius of 50% to them. With some box shadows, we&#8217;ll make them look inset. The currently active navigation dot will have a pseudo-element (white dot) which will be placed on top of it:</p>
<pre class="brush:css">
.nav-dots {
	text-align: center;
	position: absolute;
	bottom: 2%;
	height: 30px;
	width: 100%;
	left: 0;
	z-index: 1000;
}

.nav-dots span {
	display: inline-block;
	position: relative;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	margin: 3px;
	background: #ddd;
	background: rgba(150,150,150,0.4);
	cursor: pointer;
	box-shadow: 
		0 1px 1px rgba(255,255,255,0.4), 
		inset 0 1px 1px rgba(0,0,0,0.1);
}

.nav-dots span.nav-dot-current:after {
	content: "";
	position: absolute;
	width: 10px;
	height: 10px;
	top: 3px;
	left: 3px;
	border-radius: 50%;
	background: rgba(255,255,255,0.8);
}
</pre>
<p>The elements that we&#8217;ll use in the content will be a decorative element (the animal with the circles), a headline and a blockquote. We&#8217;ll use a font to give us some cute animal &#8220;icons&#8221; that we&#8217;ll place as a pseudo element of the decorative div. </p>
<p>The division with the class <strong>deco</strong>, just like all the other content elements, will have an absolute position. We&#8217;ll center it horizontally and give it a bottom value of 50%:</p>
<pre class="brush:css">
.deco {
	width: 260px;
	height: 260px;
	border: 2px dashed #ddd;
	border: 2px dashed rgba(150,150,150,0.4);
	border-radius: 50%;
	position: absolute;
	bottom: 50%;
	left: 50%;
	margin: 0 0 0 -130px;
}
</pre>
<p>We use a data attribute &#8220;data-icon&#8221; in the decorative element and we&#8217;ll style the pseudo-element :after to contain the letter from the animal icon font as its content:</p>
<pre class="brush:css">
[data-icon]:after {
    content: attr(data-icon);
    font-family: 'AnimalsNormal';
	color: #999;
	text-shadow: 0 0 1px #999;
	position: absolute;
	width: 220px;
	height: 220px;
	line-height: 220px;
	text-align: center;
	font-size: 100px;
	top: 50%;
	left: 50%;
	margin: -110px 0 0 -110px;
	box-shadow: inset 0 0 0 10px #f7f7f7;
	border-radius: 50%;
}
</pre>
<p>The box shadow will create a &#8220;fake&#8221; inset border.</p>
<p>The headline will also be positioned absolutely and we&#8217;ll give it the same bottom value like we gave to the decorative element, which is 50%. We then add a negative bottom margin in order to place it under the other element. Like that we can use the decorative element as a reference point and position the other elements relatively to it using a negative bottom margin:</p>
<pre class="brush:css">
.sl-slide h2 {
	color: #000;
	text-shadow: 0 0 1px #000;
	padding: 20px;
	position: absolute;
	font-size: 34px;
	font-weight: 700;
	letter-spacing: 13px;
	text-transform: uppercase;
	width: 80%;
	left: 10%;
	text-align: center;
	line-height: 50px;
	bottom: 50%;
	margin: 0 0 -120px 0;
}
</pre>
<p>The blockquote will be of 100% width and we will center the paragraph inside which will have a maximum width of 400 pixel:</p>
<pre class="brush:css">
.sl-slide blockquote {
	position: absolute;
	width: 100%;
	text-align: center;
	left: 0;
	font-weight: 400;
	font-size: 14px;
	line-height: 20px;
	height: 70px;
	color: #8b8b8b;
	z-index: 2;
	bottom: 50%;
	margin: 0 0 -200px 0;
	padding: 0;
}

.sl-slide blockquote p{
	margin: 0 auto;
	width: 60%;
	max-width: 400px;
	position: relative;
}
</pre>
<p>Let&#8217;s add a quotation mark to the blockquote. Using the pseudo-class :before, we&#8217;ll add a over-sized quotation mark behind the blockquote:</p>
<pre class="brush:css">
.sl-slide blockquote p:before {
	color: #f0f0f0;
	color: rgba(244,244,244,0.65);
	font-family: "Bookman Old Style", Bookman, Garamond, serif;
	position: absolute;
	line-height: 60px;
	width: 75px;
	height: 75px;
	font-size: 200px;
	z-index: -1;
	left: -80px;
	top: 35px;
	content: '\201C';
}
</pre>
<p>And the cite will have a different look:</p>
<pre class="brush:css">
.sl-slide blockquote cite {
	font-size: 10px;
	padding-top: 10px;
	display: inline-block;
	font-style: normal;
	text-transform: uppercase;
	letter-spacing: 4px;
}
</pre>
<p>Next, we&#8217;ll define some classes for controling the colors of the slides. When we give this color class to the slide, we want the background color and the color of the elements to be different. By default, our slides are white/gray and the content elements are black and gray.</p>
<p>We also need to give the same background color to the dynamic slice element, the one that will have a large padding:</p>
<pre class="brush:css">
/* First Slide */
.bg-1 .sl-slide-inner,
.bg-1 .sl-content-slice {
	background: #fff;
}

/* Second Slide */
.bg-2 .sl-slide-inner,
.bg-2 .sl-content-slice {
	background: #000;
}

.bg-2 [data-icon]:after,
.bg-2 h2 {
	color: #fff;
}

.bg-2 blockquote:before {
	color: #222;
}

/* Third Slide */
.bg-3 .sl-slide-inner,
.bg-3 .sl-content-slice {
	background: #db84ad;
}

.bg-3 .deco {
	border-color: #fff;
	border-color: rgba(255,255,255,0.5);
}

.bg-3 [data-icon]:after {
	color: #fff;
	text-shadow: 0 0 1px #fff;
	box-shadow: inset 0 0 0 10px #b55381;
}

.bg-3 h2,
.bg-3 blockquote{
	color: #fff;
	text-shadow: 0px 1px 1px rgba(0,0,0,0.3);
}

.bg-3 blockquote:before {
	color: #c46c96;
}

/* Forth Slide */
.bg-4 .sl-slide-inner,
.bg-4 .sl-content-slice {
	background: #5bc2ce;
}

.bg-4 .deco {
	border-color: #379eaa;
}

.bg-4 [data-icon]:after {
	text-shadow: 0 0 1px #277d87;
	color: #277d87;
}

.bg-4 h2,
.bg-4 blockquote{
	color: #fff;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.bg-4 blockquote:before {
	color: #379eaa;
}

/* Fifth Slide */
.bg-5 .sl-slide-inner,
.bg-5 .sl-content-slice {
	background: #ffeb41;
}

.bg-5 .deco {
	border-color: #ECD82C;
}

.bg-5 .deco:after {
	color: #000;
	text-shadow: 0 0 1px #000;
}

.bg-5 h2,
.bg-5 blockquote{
	color: #000;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}

.bg-5 blockquote:before {
	color: #ecd82c;
}
</pre>
<p>And now, let&#8217;s add some motion to the content elements! When we navigate the slides, we want the content elements to do something fun, so we will add a class to the next slide whenever we navigate to the &#8220;right&#8221; (or &#8220;in&#8221; since this almost looks like as if we are moving further). That class will &#8220;trigger&#8221; an animation for each one of the content elements:</p>
<pre class="brush:css">

/* Animations for elements */

.sl-trans-elems .deco{
	animation: roll 1s ease-out both;
}

.sl-trans-elems h2{
	animation: moveUp 1s ease-in-out both;
}

.sl-trans-elems blockquote{
	animation: fadeIn 0.5s linear 0.5s both;
}

@keyframes roll{
	0% {transform: translateX(500px) rotate(360deg); opacity: 0;}
	100% {transform: translateX(0px) rotate(0deg); opacity: 1;}
}

@keyframes moveUp{
	0% {transform: translateY(40px);}
	100% {transform: translateY(0px);}
}

@keyframes fadeIn{
	0% {opacity: 0;}
	100% {opacity: 1;}
}
</pre>
<p>The decorative element will &#8220;roll in&#8221; from the right side, the heading will move up and the blockquote will simply fade in.</p>
<p>Now, when we navigate back (or &#8220;out&#8221;), we want to see the reverse happening:</p>
<pre class="brush:css">
.sl-trans-back-elems .deco{
	animation: scaleDown 1s ease-in-out both;
}

.sl-trans-back-elems h2{
	animation: fadeOut 1s ease-in-out both;
}

.sl-trans-back-elems blockquote{
	animation: fadeOut 1s linear both;
}

@keyframes scaleDown{
	0% {transform: scale(1);}
	100% {transform: scale(0.5);}
}

@keyframes fadeOut{
	0% {opacity: 1;}
	100% {opacity: 0;}
}
</pre>
<p>Here we will scale down the decorative element and simply fade out the rest.<br />
And that&#8217;s all the style! Let&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>Let&#8217;s first take a look at our plugin options:</p>
<pre class="brush:js">
$.Slitslider.defaults 	= {
	// transitions speed
	speed : 800,
	// if true the item's slices will also animate the opacity value
	optOpacity : false,
	// amount (%) to translate both slices - adjust as necessary
	translateFactor : 230,
	// maximum possible angle
	maxAngle : 25,
	// maximum possible scale
	maxScale : 2,
	// slideshow on / off
	autoplay : false,
	// keyboard navigation
	keyboard : true,
	// time between transitions
	interval : 4000,
	// callbacks
	onBeforeChange : function( slide, idx ) { return false; },
	onAfterChange : function( slide, idx ) { return false; }
};
</pre>
<p>We can set the speed of the transitions, set the slideshow to play automatically with a specific interval and also make the slide&#8217;s slices opacity change during the transition.</p>
<p>The <strong>translateFactor</strong> option is the amount in percentage for translating both slices. You can adjust this value as necessary as you change the slide&#8217;s scale and angle data attributes and the maxAngle and maxScale values.</p>
<p>We will start by executing the <strong>_init</strong> function.</p>
<pre class="brush:js">

_init				: function( options ) {
			
	// options
	this.options = $.extend( true, {}, $.Slitslider.defaults, options );

	// https://github.com/twitter/bootstrap/issues/2870
	this.transEndEventNames = {
		'WebkitTransition' : 'webkitTransitionEnd',
		'MozTransition' : 'transitionend',
		'OTransition' : 'oTransitionEnd',
		'msTransition' : 'MSTransitionEnd',
		'transition' : 'transitionend'
	};
	this.transEndEventName = this.transEndEventNames[ Modernizr.prefixed( 'transition' ) ];
	// suport for css 3d transforms and css transitions
	this.support = Modernizr.csstransitions &#038;&#038; Modernizr.csstransforms3d;
	// the slider
	this.$el = this.$elWrapper.children( '.sl-slider' );
	// the slides
	this.$slides = this.$el.children( '.sl-slide' ).hide();
	// total slides
	this.slidesCount = this.$slides.length;
	// current slide
	this.current = 0;
	// control if it's animating
	this.isAnimating = false;
	// get container size
	this._getSize();
	// layout
	this._layout();
	// load some events
	this._loadEvents();
	// slideshow
	if( this.options.autoplay ) {
	
		this._startSlideshow();
	
	}
	
}

</pre>
<p>Let&#8217;s take a look at the <strong>_layout</strong> function:</p>
<pre class="brush:js">

_layout				: function() {
			
	this.$slideWrapper = $( '&lt;div class="sl-slides-wrapper" /&gt;' );
			
	// wrap the slides
	this.$slides.wrapAll( this.$slideWrapper ).each( function( i ) {
		
		var $slide = $( this ),
			// vertical || horizontal
			orientation = $slide.data( 'orientation' );
			
		$slide.addClass( 'sl-slide-' + orientation )
			  .children()
			  .wrapAll( '&lt;div class="sl-content-wrapper" /&gt;' )
			  .wrapAll( '&lt;div class="sl-content" /&gt;' );
	
	} );
	
	// set the right size of the slider/slides for the current window size
	this._setSize();
	// show first slide
	this.$slides.eq( this.current ).show();
	
}

</pre>
<p>We are wrapping the slides into a division with the class &#8220;sl-slides-wrapper&#8221;. As we&#8217;ve mentioned before, each slide&#8217;s content will also be wrapped by two divisions, one with the class <strong>sl-content</strong> and one with the class <strong>sl-content-wrapper</strong>.</p>
<p>We also add the respective orientation class to the slide (<strong>sl-slide-vertical</strong> or <strong>sl-slide-horizontal</strong>).</p>
<p>The slider and its <strong>sl-content-wrapper</strong> division need to have the main container&#8217;s width and height. That&#8217;s what we do in the <strong>_setSize</strong> function.</p>
<p>Finally, we&#8217;ll show the current/first slide.</p>
<p>In the <strong>_loadEvents</strong> function we will bind the click events for the keyboard navigation and the resize (smartresize) event to the window:</p>
<pre class="brush:js">

_loadEvents			: function() {
			
	var self = this;
			
	$window.on( 'debouncedresize.slitslider', function( event ) {
		
		// update size values
		self._getSize();
		// set the sizes again
		self._setSize();
		
	} );

	if ( this.options.keyboard ) {
		
		$document.on( 'keydown.slitslider', function(e) {

			var keyCode = e.keyCode || e.which,
				arrow = {
					left: 37,
					up: 38,
					right: 39,
					down: 40
				};

			switch (keyCode) {
				
				case arrow.left :

					self._stopSlideshow();
					self._navigate( 'prev' );
					break;
				
				case arrow.right :
					
					self._stopSlideshow();
					self._navigate( 'next' );
					break;

			}

		} );

	}

}

</pre>
<p>Let&#8217;s see how we &#8220;slice&#8221; the slides and move to the next one:</p>
<pre class="brush:js">

_navigate : function( dir, pos ) {
	
	if( this.isAnimating || this.slidesCount < 2 ) {
	
		return false;
	
	}

	this.isAnimating = true;

	var self = this,
		$currentSlide = this.$slides.eq( this.current );

	// if position is passed
	if( pos !== undefined ) {

		this.current = pos;

	}
	// if not check the boundaries
	else if( dir === 'next' ) {

		this.current = this.current < this.slidesCount - 1 ? ++this.current : 0;

	}
	else if( dir === 'prev' ) {

		this.current = this.current > 0 ? --this.current : this.slidesCount - 1;

	}

	this.options.onBeforeChange( $currentSlide, this.current );
	
	// next slide to be shown
	var $nextSlide = this.$slides.eq( this.current ),
		// the slide we want to cut and animate
		$movingSlide = ( dir === 'next' ) ? $currentSlide : $nextSlide,
		
		// the following are the data attrs set for each slide
		configData = $movingSlide.data(),
		config = {};
	
	config.orientation = configData.orientation || 'horizontal',
	config.slice1angle = configData.slice1Rotation || 0,
	config.slice1scale = configData.slice1Scale || 1,
	config.slice2angle = configData.slice2Rotation || 0,
	config.slice2scale = configData.slice2Scale || 1;
		
	this._validateValues( config );
	
	var cssStyle = config.orientation === 'horizontal' ? {
			marginTop : -this.size.height / 2
		} : {
			marginLeft : -this.size.width / 2
		},
		// default slide's slices style
		resetStyle = {
			'transform' : 'translate(0%,0%) rotate(0deg) scale(1)',
			opacity : 1 
		},
		// slice1 style
		slice1Style	= config.orientation === 'horizontal' ? {
			'transform' : 'translateY(-' + this.options.translateFactor + '%) rotate(' + config.slice1angle + 'deg) scale(' + config.slice1scale + ')'
		} : {
			'transform' : 'translateX(-' + this.options.translateFactor + '%) rotate(' + config.slice1angle + 'deg) scale(' + config.slice1scale + ')'
		},
		// slice2 style
		slice2Style	= config.orientation === 'horizontal' ? {
			'transform' : 'translateY(' + this.options.translateFactor + '%) rotate(' + config.slice2angle + 'deg) scale(' + config.slice2scale + ')'
		} : {
			'transform' : 'translateX(' + this.options.translateFactor + '%) rotate(' + config.slice2angle + 'deg) scale(' + config.slice2scale + ')'
		};
	
	if( this.options.optOpacity ) {
	
		slice1Style.opacity = 0;
		slice2Style.opacity = 0;
	
	}
	
	// we are adding the classes sl-trans-elems and sl-trans-back-elems to the slide that is either coming "next"
	// or going "prev" according to the direction.
	// the idea is to make it more interesting by giving some animations to the respective slide's elements
	//( dir === 'next' ) ? $nextSlide.addClass( 'sl-trans-elems' ) : $currentSlide.addClass( 'sl-trans-back-elems' );
	
	$currentSlide.removeClass( 'sl-trans-elems' );

	var transitionProp = {
		'transition' : 'all ' + this.options.speed + 'ms ease-in-out'
	};

	// add the 2 slices and animate them
	$movingSlide.css( 'z-index', this.slidesCount )
				.find( 'div.sl-content-wrapper' )
				.wrap( $( '&lt;div class="sl-content-slice" /&gt;' ).css( transitionProp ) )
				.parent()
				.cond(
					dir === 'prev', 
					function() {
					
						var slice = this;
						this.css( slice1Style );
						setTimeout( function() {
							
							slice.css( resetStyle );

						}, 50 );
								 
					}, 
					function() {
						
						var slice = this;
						setTimeout( function() {
							
							slice.css( slice1Style );

						}, 50 );
				
					}
				)
				.clone()
				.appendTo( $movingSlide )
				.cond(
					dir === 'prev', 
					function() {
						
						var slice = this;
						this.css( slice2Style );
						setTimeout( function() {

							$currentSlide.addClass( 'sl-trans-back-elems' );

							if( self.support ) {

								slice.css( resetStyle ).on( self.transEndEventName, function() {

									self._onEndNavigate( slice, $currentSlide, dir );

								} );

							}
							else {

								self._onEndNavigate( slice, $currentSlide, dir );

							}

						}, 50 );
				
					},
					function() {
						
						var slice = this;
						setTimeout( function() {

							$nextSlide.addClass( 'sl-trans-elems' );
							
							if( self.support ) {

								slice.css( slice2Style ).on( self.transEndEventName, function() {

									self._onEndNavigate( slice, $currentSlide, dir );

								} );

							}
							else {

								self._onEndNavigate( slice, $currentSlide, dir );

							}

						}, 50 );
						
					}
				)
				.find( 'div.sl-content-wrapper' )
				.css( cssStyle );
	
	$nextSlide.show();
	
}

</pre>
<p>So, the trick is to duplicate the slide&#8217;s content into the divisions with the class <strong>sl-content-slice</strong> and to set the second one&#8217;s margin-left or margin-top to half the container&#8217;s width or height. That will make everything look &#8220;normal&#8221; and we won&#8217;t see any separation.</p>
<p>Then, according to the values defined in the element&#8217;s data attributes, we&#8217;ll animate the slide&#8217;s slices.</p>
<p>According to the direction, we will either slice the current slide and show the next one, or we will slice the previous one (not shown), and put together its slices on top of the current one. </p>
<p>We are adding the classes <strong>sl-trans-elems</strong> and <strong>sl-trans-back-elems</strong> to the slide that is next (when we navigate &#8220;next&#8221;) or the current one (when we navigate &#8220;prev&#8221;). Like we have seen before in the CSS part, adding those classes will make the content elements of the respective slide animate in a specific way.</p>
<p>Once the transition ends, we call the <strong>_onEndNavigate</strong> function where we will unwrap the content of the current slide, thus removing the two <strong>sl-content-slice</strong> divisions:</p>
<pre class="brush:js">

_onEndNavigate : function( $slice, $oldSlide, dir ) {
			
	// reset previous slide's style after next slide is shown
	var $slide = $slice.parent(),
		removeClasses = 'sl-trans-elems sl-trans-back-elems';
	
	// remove second slide's slice
	$slice.remove();
	// unwrap..
	$slide.css( 'z-index', 1 )
		  .find( 'div.sl-content-wrapper' )
		  .unwrap();
	
	// hide previous current slide
	$oldSlide.hide().removeClass( removeClasses );
	$slide.removeClass( removeClasses );
	// now we can navigate again..
	this.isAnimating = false;
	this.options.onAfterChange( $slide, this.current );
	
}

</pre>
<p>Finally, the plugin offers several public methods which one can call to trigger specific actions (navigation, pause the slideshow etc..)</p>
<pre class="brush:js">

// public method: adds more slides to the slider
add : function( $slides, callback ) {

	this.$slides = this.$slides.add( $slides );

	var self = this;
	
	
	$slides.each( function( i ) {

		var $slide = $( this ),
			// vertical || horizontal
			orientation = $slide.data( 'orientation' );

		$slide.hide().addClass( 'sl-slide-' + orientation )
			  .children()
			  .wrapAll( '&lt;div class="sl-content-wrapper" /&gt;' )
			  .wrapAll( '&lt;div class="sl-content" /&gt;' )
			  .end()
			  .appendTo( self.$el.find( 'div.sl-slides-wrapper' ) );

	} );

	this._setSize();

	this.slidesCount = this.$slides.length;
	
	if ( callback ) {

		callback.call( $items );

	}

},
// public method: shows next slide
next : function() {

	this._stopSlideshow();
	this._navigate( 'next' );

},
// public method: shows previous slide
previous : function() {

	this._stopSlideshow();
	this._navigate( 'prev' );

},
// public method: goes to a specific slide
jump : function( pos ) {

	pos -= 1;

	if( pos === this.current || pos >= this.slidesCount || pos < 0 ) {

		return false;

	}

	this._stopSlideshow();
	this._navigate( pos > this.current ? 'next' : 'prev', pos );

},
// public method: starts the slideshow
// any call to next(), previous() or jump() will stop the slideshow
play : function() {

	if( !this.isPlaying ) {

		this.isPlaying = true;

		this._navigate( 'next' );
		this.options.autoplay = true;
		this._startSlideshow();

	}

},
// public method: pauses the slideshow
pause : function() {

	if( this.isPlaying ) {

		this._stopSlideshow();

	}

},
// public method: check if isAnimating is true
isActive : function() {

	return this.isAnimating;

},
// publicc methos: destroys the slicebox instance
destroy : function( callback ) {

	this._destroy( callback );

}

</pre>
<p>And that&#8217;s it! I hope you enjoyed this tutorial and find it useful!</p>
<div class="ct-github-link"><a href="https://github.com/codrops/SlitSlider">Find this project on Github</a></div>
<p><a class="demo" href="http://tympanus.net/Tutorials/FullscreenSlitSlider/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/FullscreenSlitSlider/FullscreenSlitSlider.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/06/05/fullscreen-slit-slider-with-jquery-and-css3/feed/</wfw:commentRss>
		<slash:comments>142</slash:comments>
		</item>
		<item>
		<title>How to Create a Fast Hover Slideshow with CSS3</title>
		<link>http://tympanus.net/codrops/2012/05/09/how-to-create-a-fast-hover-slideshow-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/05/09/how-to-create-a-fast-hover-slideshow-with-css3/#comments</comments>
		<pubDate>Wed, 09 May 2012 11:31:57 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8846</guid>
		<description><![CDATA[A little fast-running image slideshow that plays on hover and pauses when mousing out. The current image will stay visible.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/TipsTricks/FastHoverSlideshow/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/FastHoverslideshow.jpg" alt="How to Create a Fast Hover Slideshow with CSS3" title="How to Create a Fast Hover Slideshow with CSS3" width="580" height="315" class="alignnone size-full wp-image-8851" /></a></p>
<p><a class="demo" href="http://tympanus.net/TipsTricks/FastHoverSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/TipsTricks/FastHoverSlideshow/FastHoverSlideshow.zip">Download source</a></p>
<p>Today I want to share a little hover slideshow with you. The main idea is to run a super-fast image slideshow on hover and show the current image when mousing out. It&#8217;s just a fancy effect to play with and I got the idea from <a href="http://containr.org/">Contain.r</a>. We&#8217;ll be using CSS animations for the slideshow and control the pausing and running with <a href="http://dev.w3.org/csswg/css3-animations/#animation-play-state-property">animation-play-state</a>.</p>
<div class="ct-special-box"><strong>Please note: this is just experimental and will only work as intended in browsers that support the respective CSS properties.</strong></div>
<p>This is our simple structure:</p>
<pre class="brush:html">
&lt;div class="hs-wrapper"&gt;

	&lt;img src="images/1.jpg" alt="image01"/&gt;
	&lt;img src="images/2.jpg" alt="image02"/&gt;
	&lt;img src="images/3.jpg" alt="image03"/&gt;
	&lt;img src="images/4.jpg" alt="image04"/&gt;
	&lt;img src="images/5.jpg" alt="image05"/&gt;
	&lt;img src="images/6.jpg" alt="image06"/&gt;
	&lt;img src="images/7.jpg" alt="image07"/&gt;
	&lt;img src="images/8.jpg" alt="image08"/&gt;
	
	&lt;div class="hs-overlay"&gt;
		&lt;span&gt;Summer &lt;strong&gt;2012&lt;/strong&gt;&lt;/span&gt;
	&lt;/div&gt;
	
&lt;/div&gt;
</pre>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<p>We&#8217;ll show and hide the images using an animation:</p>
<pre class="brush:css">
.hs-wrapper img{
	top: 0px;
	left: 0px;
	position: absolute;
	animation: showMe 0.8s linear infinite 0s forwards;
	animation-play-state: paused;	
}
</pre>
<p>The animation will be paused and we&#8217;ll just run it on hover:</p>
<pre class="brush:css">
.hs-wrapper:hover img{
	animation-play-state: running;
}
</pre>
<p>The animation will simply make an image visible and put it on top of the &#8220;stack&#8221;:</p>
<pre class="brush:css">
@keyframes showMe {
    0% { visibility: visible; z-index: 100; }
	12.5% { visibility: visible; z-index: 100; }
	25% { visibility: hidden; z-index: 0; }
    100% { visibility: hidden; z-index: 0; }
}
</pre>
<p>As you can see, each image will have the same animation but we will start the animation for each image with a delay. We also want to reverse the stacking order of the images by setting the z-index accordingly. Since we will run the whole animation for 0.8 seconds, we&#8217;ll delay the start for each image with 0.1 second (except the first one):</p>
<pre class="brush:css">
.hs-wrapper img:nth-child(1){
	z-index: 9;
}
.hs-wrapper img:nth-child(2){
	animation-delay: 0.1s;
	z-index: 8;
}
.hs-wrapper img:nth-child(3){
	animation-delay: 0.2s;
	z-index: 7;
}
.hs-wrapper img:nth-child(4){
	animation-delay: 0.3s;
	z-index: 6;
}
<!-- ... and so on -->
</pre>
<p>The percentages of the animation are calculated as follows: take the 100% of the animation timespan and distribute 8 images over it. Each one runs 0.1 seconds which means that at 12.5% we want the second image to show. The second image that will show, will be on top of the current one (although they have the same z-index) because it follows in the HTML structure. Having tried some other possibilities (i.e. not messing around with the z-index, setting 12.6% as the next step, etc.) it seems that this variant performs the smoothest. Nonetheless, sometimes there seems to be a bit of a lag. </p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/animation.jpg" alt="animation" title="" width="580" height="315" class="alignnone size-full wp-image-8848" /></p>
<p>The overlay, which will be shown on hover, will have an absolute position and since we want to fade it in and animate the box shadow, we&#8217;ll add a transition to it:</p>
<pre class="brush:css">
.hs-overlay{
	position: absolute;
	width: 100%;
	height: 100%;
	opacity: 0;
	z-index: 500;
	background: rgba(0,0,0,0.6);
	box-shadow: 0 0 0 0 rgba(255,255,255,0.3) inset;
	pointer-events: none;
	transition: all 0.3s linear;
}
</pre>
<p>On hover, when the slideshow starts running, we&#8217;ll show the overlay:</p>
<pre class="brush:css">
.hs-wrapper:hover .hs-overlay{
	opacity: 1;
	box-shadow: 0 0 0 5px rgba(255,255,255,0.3) inset;
}
</pre>
<p>You can increase the opacity level of the background color of the overlay in order to make the effect more subtle. Note, that the images have the same background which makes this effect less seizure-inducing than if you would use a different color for each one. Black and white images with a not too transparent overlay like in <a href="http://containr.org/">Contain.r</a> are a good fit for this effect.</p>
<p>It&#8217;s as well important to note that it should be made sure that the images are of course loaded and apply something similar to <a href="http://css-tricks.com/transitions-only-after-page-load/">what Chris Coyier suggests here</a>.</p>
<p>And that&#8217;s it! I hope you find it inspiring. </p>
<p><a class="demo" href="http://tympanus.net/TipsTricks/FastHoverSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/TipsTricks/FastHoverSlideshow/FastHoverSlideshow.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/05/09/how-to-create-a-fast-hover-slideshow-with-css3/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 16/25 queries in 0.018 seconds using disk: basic
Content Delivery Network via codropspz.tympanus.netdna-cdn.com

 Served from: tympanus.net @ 2013-05-24 18:17:36 by W3 Total Cache -->