<?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; gallery</title>
	<atom:link href="http://tympanus.net/codrops/tag/gallery/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Wed, 23 May 2012 09:46:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>3D Gallery with CSS3 and jQuery</title>
		<link>http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/</link>
		<comments>http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 07:30:10 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=7643</guid>
		<description><![CDATA[Today, we want to share an experimental 3D gallery with you that uses CSS 3D transforms.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/3DGallery/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/3DGallery.jpg" alt="3DGallery" title="" width="580" height="315" class="alignnone size-full wp-image-7646" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/3DGallery/">View demo</a> <a class="download" href="http://tympanus.net/Development/3DGallery/3DGallery.zip">Download source</a></p>
<p>With 3D transforms, we can make simple elements more interesting by setting them into three dimensional space. Together with CSS transitions, these elements can be moved in 3D space and create a realistic effect. Today, we want to share an experimental 3D gallery with you that uses CSS 3D transforms.</p>
<p>The main idea is to create a circular gallery where we have an image in the center and two on the sides. Since we are using perspective, the two lateral images will appear three dimensional when we rotate them.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<p><strong>Please note that this will only work in browsers that support CSS 3D transforms.</strong></p>
<h3>How it works</h3>
<p>The following HTML structure is used for the gallery:</p>
<pre class="brush:xml">
&lt;section id="dg-container" class="dg-container"&gt;
	&lt;div class="dg-wrapper"&gt;
		&lt;a href="#"&gt;
			&lt;img src="images/1.jpg" alt="image01"&gt;
			&lt;div&gt;http://www.colazionedamichy.it/&lt;/div&gt;
		&lt;/a&gt;
		&lt;a href="#"&gt;
			&lt;!-- ... --&gt;
		&lt;/a&gt;
		&lt;!-- ... --&gt;
	&lt;/div&gt;
	&lt;nav&gt;
		&lt;span class="dg-prev"&gt;&lt;&lt;/span&gt;
		&lt;span class="dg-next"&gt;&gt;&lt;/span&gt;
	&lt;/nav&gt;
&lt;/section&gt;
</pre>
<p>And this is how the gallery is initialized:</p>
<pre class="brush:js">
$('#dg-container').gallery();
</pre>
<h3>Options</h3>
<p>The following options are available:</p>
<pre class="brush:js">
current		: 0,
// index of current item

autoplay	: false,
// slideshow on / off

interval	: 2000
// time between transitions
</pre>
<p>I hope you enjoy it!</p>
<p><a class="demo" href="http://tympanus.net/Development/3DGallery/">View demo</a> <a class="download" href="http://tympanus.net/Development/3DGallery/3DGallery.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>CSS3 Lightbox</title>
		<link>http://tympanus.net/codrops/2011/12/26/css3-lightbox/</link>
		<comments>http://tympanus.net/codrops/2011/12/26/css3-lightbox/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 12:36:30 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[thumbnails]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6953</guid>
		<description><![CDATA[Today we want to show you how to create a neat lightbox effect using only CSS. The idea is to have some thumbnails that are clickable, and once clicked, the respective large image is shown. Using CSS transitions and animations, we can make the large image appear in a fancy way. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3Lightbox/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/CSS3Lightbox.jpg" alt="CSS3Lightbox" width="580" height="315" class="aligncenter size-full wp-image-6959" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/CSS3Lightbox/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3Lightbox/CSS3Lightbox.zip">Download source</a></p>
<p>Today we want to show you how to create a neat lightbox effect using only CSS. The idea is to have some thumbnails that are clickable, and once clicked, the respective large image is shown. Using CSS transitions and animations, we can make the large image appear in a fancy way. </p>
<p>With the help of the pseudo-class <a href="http://www.w3.org/TR/css3-selectors/#target-pseudo">:target</a>, we will be able to show the lightbox images and navigate through them.</p>
<p>The beautiful images are by <a href="http://www.behance.net/qstra">Joanna Kustra</a> and they are licensed under the <a href="http://creativecommons.org/licenses/by-nc/3.0/">Attribution-NonCommercial 3.0 Unported Creative Commons License</a>.</p>
<p><em>Please note that this will only work with browsers that support the :target pseudo class.</em></p>
<p>Let&#8217;s do it!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We want to show a set of thumbnails, each one having a title that will appear on hover. When clicking on a thumbnail, we want to show a large version of the image in an overlay container that will make the background a bit more opaque. So, let&#8217;s use an unordered list where each list item will contain a thumbnail and a division for the overlay with the respective large version of the image:</p>
<pre class="brush:xml">
&lt;ul class="lb-album"&gt;
	&lt;li&gt;
		&lt;a href="#image-1"&gt;
			&lt;img src="images/thumbs/1.jpg" alt="image01"&gt;
			&lt;span&gt;Pointe&lt;/span&gt;
		&lt;/a&gt;
		&lt;div class="lb-overlay" id="image-1"&gt;
			&lt;img src="images/full/1.jpg" alt="image01" /&gt;
			&lt;div&gt;
				&lt;h3&gt;pointe &lt;span&gt;/point/&lt;/h3&gt;
				&lt;p&gt;Dance performed on the tips of the toes&lt;/p&gt;
				&lt;a href="#image-10" class="lb-prev"&gt;Prev&lt;/a&gt;
				&lt;a href="#image-2" class="lb-next"&gt;Next&lt;/a&gt;
			&lt;/div&gt;
			&lt;a href="#page" class="lb-close"&gt;x Close&lt;/a&gt;
		&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;!-- ... --&gt;
	&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/CSS3Lightbox02.jpg" alt="CSS3Lightbox01" width="580" height="246" class="aligncenter size-full wp-image-6957" /></p>
<p>The anchor for the thumbnail will point to the element with the id <strong>image-1</strong> which is the division with the class <strong>lb-overlay</strong>. In order to navigate through the images, we will add two link elements that point to the previous and next (large) image.<br />
In order to &#8220;close&#8221; the lightbox, we will somply click on the link with the class <strong>lb-close</strong> which points to the element with the ID <strong>page</strong> which is our body.</p>
<p><em>Note that we only use a navigation in the last demo.</em></p>
<p>Let&#8217;s beautify this naked markup.</p>
<h3>The CSS</h3>
<p><em>I&#8217;ll omit the vendor prefixes for some of the new properties here in order not to bloat the tutorial. You can, of course, find them in the download files.</em></p>
<p>Let&#8217;s give some basic layout to our unordered list and the thumbnails:</p>
<pre class="brush:css">
.lb-album{
	width: 900px;
	margin: 0 auto;
	font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
}
.lb-album li{
	float: left;
	margin: 5px;
	position: relative;
}
.lb-album li > a,
.lb-album li > a img{
	display: block;
}
.lb-album li > a{
	width: 150px;
	height: 150px;
	position: relative;
	padding: 10px;
	background: #f1d2c2;
	box-shadow: 1px 1px 2px #fff, 1px 1px 2px rgba(158,111,86,0.3) inset;
	border-radius: 4px;
}
</pre>
<p>The title for each thumbnail will be invisible and we&#8217;ll add a transitions for the opacity which will change to 1 once we hover over the thumbnail anchor. We&#8217;ll use a smooth radial gradient as background:</p>
<pre class="brush:css">
.lb-album li > a span{
	position: absolute;
	width: 150px;
	height: 150px;
	top: 10px;
	left: 10px;
	text-align: center;
	line-height: 150px;
	color: rgba(27,54,81,0.8);
	text-shadow: 0px 1px 1px rgba(255,255,255,0.6);
	font-size: 24px;
	opacity: 0;
	background:
		radial-gradient(
			center,
			ellipse cover,
			rgba(255,255,255,0.56) 0%,
			rgba(241,210,194,1) 100%
		);
	transition: opacity 0.3s linear;
}
.lb-album li > a:hover span{
	opacity: 1;
}
</pre>
<p>The overlay will have the same radial gradient and we&#8217;ll set its position to fixed, with zero height and width:</p>
<pre class="brush:css">
.lb-overlay{
	width: 0px;
	height: 0px;
	position: fixed;
	overflow: hidden;
	left: 0px;
	top: 0px;
	padding: 0px;
	z-index: 99;
	text-align: center;
	background:
		radial-gradient(
			center,
			ellipse cover,
			rgba(255,255,255,0.56) 0%,
			rgba(241,210,194,1) 100%
		);
}
</pre>
<p>Once we click on a thumbnail, we&#8217;ll cover the whole screen with the overlay, but first, let&#8217;s take a look at the children.</p>
<p>Let&#8217;s style the division for the main title and the description:</p>
<pre class="brush:css">
.lb-overlay > div{
	position: relative;
	color: rgba(27,54,81,0.8);
	width: 550px;
	height: 80px;
	margin: 40px auto 0px auto;
	text-shadow: 0px 1px 1px rgba(255,255,255,0.6);
}
.lb-overlay div h3,
.lb-overlay div p{
	padding: 0px 20px;
	width: 200px;
	height: 60px;
}
.lb-overlay div h3{
	font-size: 36px;
	float: left;
	text-align: right;
	border-right: 1px solid rgba(27,54,81,0.4);
}
.lb-overlay div h3 span,
.lb-overlay div p{
	font-size: 16px;
	font-family: Constantia, Palatino, serif;
	font-style: italic;
}
.lb-overlay div h3 span{
	display: block;
	line-height: 6px;
}
.lb-overlay div p{
	font-size: 14px;
	text-align: left;
	float: left;
	width: 260px;
}
</pre>
<p>We&#8217;ll position the link element for closing the lightbox absolutely above the image:</p>
<pre class="brush:css">
.lb-overlay a.lb-close{
	background: rgba(27,54,81,0.8);
	z-index: 1001;
	color: #fff;
	position: absolute;
	top: 43px;
	left: 50%;
	font-size: 15px;
	line-height: 26px;
	text-align: center;
	width: 50px;
	height: 23px;
	overflow: hidden;
	margin-left: -25px;
	opacity: 0;
	box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
}
</pre>
<p>The image will have a maximum height of 100%. That&#8217;s one way of making the image somewhat reponsive and nicely fittin into the viewport (i.e our overlay). We&#8217;ll also add a transition for the opacity level. Once we &#8220;open&#8221; a large image, the opacity will get animated. We&#8217;ll see later how we can use an animation for the image.</p>
<pre class="brush:css">
.lb-overlay img{
	max-height: 100%;
	position: relative;
	opacity: 0;
	box-shadow: 0px 2px 7px rgba(0,0,0,0.2);
	transition: opacity 0.5s linear;
}
</pre>
<p>Let&#8217;s style the navigation elements:</p>
<pre class="brush:css">
.lb-prev, .lb-next{
	text-indent: -9000px;
	position: absolute;
	top: -32px;
	width: 24px;
	height: 25px;
	left: 50%;
	opacity: 0.8;
}
.lb-prev:hover, .lb-next:hover{
	opacity: 1;
}
.lb-prev{
	margin-left: -30px;
	background: transparent url(../images/arrows.png) no-repeat top left;
}
.lb-next{
	margin-left: 6px;
	background: transparent url(../images/arrows.png) no-repeat top right;
}
</pre>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/CSS3Lightbox01.jpg" alt="CSS3Lightbox01" width="580" height="400" class="aligncenter size-full wp-image-6956" /></p>
<p>When we click on a thumbnail anchor, it will point to the respective large version of the image which is in the division with the class <strong>lb-overlay</strong>. So, in order to address this element we can use the pseudo class <strong>:target</strong>. We&#8217;ll add a padding to the overlay and &#8220;stretch it&#8221; over the whole viewport by setting the width and height to auto (it&#8217;s actually not needed explicitely) and set the right and bottom to 0px. Remember, we&#8217;ve already set the top and left before. </p>
<pre class="brush:css">
.lb-overlay:target {
	width: auto;
	height: auto;
	bottom: 0px;
	right: 0px;
	padding: 80px 100px 120px 100px;
}
</pre>
<p>Now we will also set the opacity of the image and the closing link to 1. The image will fade in, because we&#8217;ve set a transition:</p>
<pre class="brush:css">
.lb-overlay:target img,
.lb-overlay:target a.lb-close{
	opacity: 1;
}
</pre>
<p>And that&#8217;s all the style!<br />
Let&#8217;s take a look at the two alternatives that we are using in demo 1 and demo 2.</p>
<p>In the first demo we make the image appear by using an animation that scales it up and increases it&#8217;s opacity value:</p>
<pre class="brush:css">
.lb-overlay:target img {
	animation: fadeInScale 1.2s ease-in-out;
}
@keyframes fadeInScale {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
</pre>
<p>In the second demo we&#8217;ll create the opposite effect, i.e. scale the image down:</p>
<pre class="brush:css">
.lb-overlay:target img {
	animation: scaleDown 1.2s ease-in-out;
}
@-webkit-keyframes scaleDown {
  0% { transform: scale(10,10); opacity: 0; }
  100% { transform: scale(1,1); opacity: 1; }
}
</pre>
<h3>Demos</h3>
<ul>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3Lightbox/index.html">Demo 1: Scale-up / fade-in animation</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3Lightbox/index2.html">Demo 2: Scale-down / fade-in animation</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3Lightbox/index3.html">Demo 3: Fade-in &amp; navigation</a></strong></li>
</ul>
<p><em>You will see that each browser performs quite differently when it comes to the transitions/animations. Adjusting duration, timing functions and delays, one can make the effects smoother, i.e. you can change the timing for Firefox only by changing the -moz- properties. </em></p>
<p>And that&#8217;s it! I hope you enjoyed this tutorial and find it inspiring! </p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3Lightbox/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3Lightbox/CSS3Lightbox.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/12/26/css3-lightbox/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>Fullscreen Image Blur Effect with HTML5</title>
		<link>http://tympanus.net/codrops/2011/11/18/fullscreen-image-blur-effect-with-html5/</link>
		<comments>http://tympanus.net/codrops/2011/11/18/fullscreen-image-blur-effect-with-html5/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 15:43:49 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[blur]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6489</guid>
		<description><![CDATA[Today we want to share a neat image blur effect with you. Using canvas, we want to blur images on the transition to another one, creating a smooth effect. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/FullscreenImageBlurEffect/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/FullscreenImageBlur.jpg" alt="FullscreenImageBlur" title="" width="580" height="315" class="aligncenter size-full wp-image-6495" /></a><br />
<a class="demo" href="http://tympanus.net/Development/FullscreenImageBlurEffect/" >View demo</a> <a class="download" href="http://tympanus.net/Development/FullscreenImageBlurEffect/FullscreenImageBlurEffect.zip">Download source</a> </p>
<p>Today we want to share a neat image blur effect with you. Using canvas, we want to blur images on the transition to another one, creating a smooth effect. </p>
<p>We will be using <a href="http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html" target="_blank">Stack Blur</a>, which is a fast, almost Gaussian blur for Canvas by Mario Klingemann from <a href="http://www.quasimondo.com/" target="_blank">Quasimondo</a>.</p>
<p>The images used in the demo are by Geoff Peters. They are licensed under the <a title="Attribution 2.0 Generic (CC BY 2.0)" href="http://creativecommons.org/licenses/by/2.0/deed.en" target="_blank">Attribution 2.0 Generic (CC BY 2.0) License</a>. </p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>How it works</h3>
<p>The main idea is to add some images in our structure that will serve as background images. We will add the canvas element which will contain a blurred version of the image. When we navigate, we&#8217;ll add the blurred canvas behind the current image and fade the current image out. With the blurred canvas image now visible, we can either show the new image immediately (unblurred) or show it blurred and then &#8220;sharpen&#8221; it.</p>
<p>You can set that by changing the <strong>variation</strong> between 1 and 2:</p>
<pre class="brush:js">
animOptions			= { speed : 700, variation : 1, blurFactor : 10 }
</pre>
<p>The speed is the animation speed between each transition (from normal to blurred) and the blurFactor is basically the radius for the blur effect used in <a href="http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html" target="_blank">Stack Blur</a>.</p>
<h3>Demos</h3>
<ul>
<li><strong><a href="http://tympanus.net/Development/FullscreenImageBlurEffect/index2.html" target="_blank">Demo 1:</a></strong> Here we use variation 2, showing the coming image without blurring it first. </li>
<li><strong><a href="http://tympanus.net/Development/FullscreenImageBlurEffect/index.html" target="_blank">Demo 2:</a></strong> In this demo we use variation 1 for blurring both, the current image and the coming one. </li>
</ul>
<p><strong>We hope you liked our little experiment and find it inspiring and useful! </strong></p>
<p><a class="demo" href="http://tympanus.net/Development/FullscreenImageBlurEffect/" >View demo</a> <a class="download" href="http://tympanus.net/Development/FullscreenImageBlurEffect/FullscreenImageBlurEffect.zip">Download source</a> </p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/11/18/fullscreen-image-blur-effect-with-html5/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Draggable Image Boxes Grid</title>
		<link>http://tympanus.net/codrops/2011/10/07/draggable-image-boxes-grid/</link>
		<comments>http://tympanus.net/codrops/2011/10/07/draggable-image-boxes-grid/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 15:22:48 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[draggable]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6002</guid>
		<description><![CDATA[Today we want to create a template with a fullscreen grid of images and content areas. The idea is to have a draggable grid that shows boxes of thumbnails and menu like items. Once clicked, the thumbnail will expand to the full size image and the menu item box will expand to a fullscreen content area. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/DraggableImageBoxesGrid/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/10/DraggableImageBoxesGrid.jpg" alt="Draggable Image Boxes Grid" width="580" height="315" class="aligncenter size-full wp-image-6019" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/DraggableImageBoxesGrid/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/DraggableImageBoxesGrid/DraggableImageBoxesGrid.zip">Download source</a></p>
<p>Today we want to create a template with a fullscreen grid of images and content areas. The idea is to have a draggable grid that shows boxes of thumbnails and menu like items. Once clicked, the thumbnail will expand to the full size image and the menu item box will expand to a fullscreen content area. </p>
<p>The main idea for this template and its effects comes from the beautiful Flash-based website of <a href="http://stephenhamilton.com" target="_blank">Stephen Hamilton</a>.</p>
<p>To make the grid draggable, we used <a href="http://the-taylors.org/jquery.kinetic/" target="_blank">jQuery.kinetic by Dave Taylor</a>. The jQuery plugin allows smooth drag scrolling and it&#8217;s just what we need in our grid.</p>
<p>The beautiful images in the demo are by Ibrahim Iujaz. Check out his <a href="http://www.flickr.com/photos/notsogoodphotography/" target="_blank">Flickr photostream</a>.</p>
<p>So, let&#8217;s begin!<br />
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></p>
<h3>The Markup</h3>
<p>The main container will be a div with the class and ID <strong>ib-main-wrapper</strong>. We will add another div element inside since we will need this structure for applying the jQuery.kinetic plugin. Inside of that div which has the class <strong>ib-main</strong>, we will place two types of link elements: the thumbnail links and the content links. The content links are the menu like boxes that will expand to a fullscreen content area: </p>
<pre class="brush:xml">
&lt;div id="ib-main-wrapper" class="ib-main-wrapper"&gt;
	&lt;div class="ib-main"&gt;
		&lt;a href="#"&gt;
			&lt;img src="images/thumbs/1.jpg" data-largesrc="images/large/1.jpg" alt="image01"/&gt;
			&lt;span&gt;Crabbed Age and Youth&lt;/span&gt;
		&lt;/a&gt;
		&lt;a href="#"&gt;
			&lt;img src="images/thumbs/2.jpg" data-largesrc="images/large/2.jpg" alt="image02"/&gt;
			&lt;span&gt;Cannot live together&lt;/span&gt;
		&lt;/a&gt;
		&lt;a href="#" class="ib-content"&gt;
			&lt;div class="ib-teaser"&gt;
				&lt;h2&gt;Welcome &lt;span&gt;Howdy, Stranger&lt;/span&gt;&lt;/h2&gt;
			&lt;/div&gt;
			&lt;div class="ib-content-full"&gt;
				&lt;!-- Some content --&gt;
			&lt;/div&gt;
		&lt;/a&gt;
		...
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The boxes for the content will have the class <strong>ib-content</strong>. The path to the large image for the thumbnails will be saved in the data attribute <strong>data-largesrc</strong>.</p>
<p>For the content and image preview we will use jQuery templates. The template for the large image preview is the following:</p>
<pre class="brush:xml">
&lt;div id="ib-img-preview" class="ib-preview"&gt;
	&lt;img src="${src}" alt="" class="ib-preview-img"/&gt;
	&lt;span class="ib-preview-descr" style="display:none;"&gt;${description}&lt;/span&gt;
	&lt;div class="ib-nav" style="display:none;"&gt;
		&lt;span class="ib-nav-prev"&gt;Previous&lt;/span&gt;
		&lt;span class="ib-nav-next"&gt;Next&lt;/span&gt;
	&lt;/div&gt;
	&lt;span class="ib-close" style="display:none;"&gt;Close Preview&lt;/span&gt;
	&lt;div class="ib-loading-large" style="display:none;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>We will have the large image, the navigation buttons, a closing cross and a loading element.</p>
<p>The template for the fullscreen content preview looks like this:</p>
<pre class="brush:xml">
&lt;div id="ib-content-preview" class="ib-content-preview"&gt;
	&lt;div class="ib-teaser" style="display:none;"&gt;{{html teaser}}&lt;/div&gt;
	&lt;div class="ib-content-full" style="display:none;"&gt;{{html content}}&lt;/div&gt;
	&lt;span class="ib-close" style="display:none;"&gt;Close Preview&lt;/span&gt;
&lt;/div&gt;
</pre>
<p>Now, let&#8217;s style the grid.</p>
<h3>The CSS</h3>
<p>First, we will style the wrapping container. It will occupy all the page&#8217;s width and we will set the height dynamically to fit the visible area:</p>
<pre class="brush:css">
.ib-main-wrapper{
    width: 100%;
    overflow: hidden;
    margin-top: 40px;
    outline: none;
    /*height dynamic*/
}
</pre>
<p>The main container will have a preset width. We chose this value because we want most visitors to be able to actually drag the grid. If you would set it to less and the user has a larger screen, then the container would be too small:</p>
<pre class="brush:css">
.ib-main{
    position: relative;
    width: 2546px;
}
</pre>
<p>Each box element will be floating and have a background image (for the thumbs) that we&#8217;ll stretch to be a bit larger than the box. We&#8217;ll add a nice transition which will make the background image contract on hover:</p>
<pre class="brush:css">
.ib-main a{
    float: left;
    width: 210px;
    height: 210px;
    position: relative;
    overflow: hidden;
    margin: 0px 0px 2px 2px;
    cursor: move;
    background: #fff url(../images/thumb_bg.jpg) no-repeat center center;
    background-size: 110% 110%;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.ib-main a:hover{
    background-size: 100% 100%;
}
</pre>
<p>The thumbnail will be slightly transparent so that we can see the background image (which is a thick border). We&#8217;ll also add some CSS3 transition here to animate the opacity on hover:</p>
<pre class="brush:css">
.ib-main a img{
    opacity: 0.95;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.ib-main a:hover img{
    opacity: 0.8;
}
</pre>
<p>The description will be positioned absolutely and we&#8217;ll place it out of the box. Then, on hover, we will make it slide in:</p>
<pre class="brush:css">
.ib-main > a > span{
    display: block;
    position: absolute;
    width: 100%;
    height: 20px;
    line-height: 22px;
    text-align: center;
    font-size: 11px;
    bottom: -20px;
    left: 0px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.ib-main a:hover > span{
    bottom: 0px;
}
</pre>
<p>When we click on the thumbnail box, we&#8217;ll change the background image in order to show the loading image:</p>
<pre class="brush:css">
.ib-main a.ib-loading,
.ib-main a.ib-loading:hover{
    background: #fff url(../images/ajax-loader.gif) no-repeat center center;
    background-size: 31px 31px;
}
.ib-main a.ib-loading img,
.ib-main a.ib-loading:hover img{
    opacity: 0.5;
}
</pre>
<p>When the thumbnail is in the loading state, we don&#8217;t want to show the description:</p>
<pre class="brush:css">
.ib-main > a.ib-loading > span,
.ib-main a.ib-loading > span{
    display: none;
}
</pre>
<p>Now we&#8217;ll style the content boxes. The background is going to be dark:</p>
<pre class="brush:css">
.ib-content{
    background: #f9f9f9;
}
</pre>
<p>The teaser is the text we&#8217;ll be showing in each content box. On hover we want to animate the background color:</p>
<pre class="brush:css">
.ib-content .ib-teaser{
    text-align: center;
    background: #333;
    width: 100%;
    height: 100%;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.ib-content .ib-teaser:hover{
    background: #000;
}
</pre>
<p>The headline and the subline will have the following style:</p>
<pre class="brush:css">
.ib-teaser h2{
    color: #fff;
    font-size: 26px;
    line-height: 26px;
    padding-top: 40%;
    text-shadow: 1px 0px 2px rgba(0,0,0,0.2);
}
.ib-teaser h2 span{
    text-transform: none;
    font-size: 16px;
    font-family: Georgia, serif;
    font-style: italic;
    display: block;
}
</pre>
<p>When the content area gets expanded, we will show the preview container and it will have an absolute position and a dynamic height:</p>
<pre class="brush:css">
.ib-content-preview{
    position: absolute;
    top: 44px;
    left: 0px;
    background: #000;
    width: 100%;
    /* height dynamic*/
    display: none;
}
</pre>
<p>The text elements will get some styling:</p>
<pre class="brush:css">
.ib-content-preview .ib-teaser h2{
    font-size: 50px;
    padding: 85px 40px 20px 40px;
}
.ib-content-preview .ib-teaser span{
    padding: 20px 0px 0px 5px;
    font-size: 22px;
}
.ib-content-full{
    font-family:'Oswald', serif;
    text-transform: none;
    line-height: 26px;
    margin: 0px 40px;
    border-top: 1px solid #333;
    padding: 20px 0px;
	font-size: 16px;
}
.ib-content-full p{
	padding: 5px 0px;
}
</pre>
<p>The large preview for the thumbnails will also be of absolute position </p>
<pre class="brush:css">
.ib-preview{
    overflow: hidden;
    position: absolute;
    top: 40px;
    display: none;
}
</pre>
<p>The description for the large image will be placed in the bottom left corner. We want big letters:</p>
<pre class="brush:css">
.ib-preview-descr{
    position: absolute;
    bottom: 30px;
    left: 10px;
    z-index: 999;
    font-size: 50px;
    text-shadow: 1px 0px 2px rgba(0,0,0,0.2);
}
</pre>
<p>The image itself will be absolute and the width and height will be set dynamically in the JavaScript:</p>
<pre class="brush:css">
.ib-preview img{
	position: absolute;
}
</pre>
<p>The navigation for the images will be placed on the left and the right side of the screen:</p>
<pre class="brush:css">
.ib-nav span{
	width: 53px;
	height: 87px;
	position: absolute;
	top: 50%;
	margin-top: -43px;
	cursor: pointer;
    text-indent: -9000px;
	opacity: 0.6;
	z-index: 999;
    background: transparent url(../images/nav.png) no-repeat top right;
	right: 10px;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-o-user-select: none;
	user-select: none;
}
.ib-nav span.ib-nav-prev{
	background-position: top left;
	left: 10px;
    right: auto;
}
</pre>
<p>The closing element will be at the top right corner:</p>
<pre class="brush:css">
.ib-close{
	top: 7px;
	right: 7px;
	background: transparent url(../images/close.png) no-repeat center center;
	position: absolute;
	width: 24px;
	height: 24px;
	cursor: pointer;
	opacity: 0.2;
	z-index: 999;
    text-indent: -9000px;
}
.ib-nav span:hover, .ib-close:hover{
	opacity: 1;
}
</pre>
<p>Last, but not least, we&#8217;ll style the loading element for the large image. We&#8217;ll place it in the center of the screen with our 50% and negative margin trick and give it some rounded borders:</p>
<pre class="brush:css">
.ib-loading-large{
    text-indent: -9000px;
    width: 60px;
    height: 60px;
    background: #fff url(../images/ajax-loader.gif) no-repeat center center;
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -30px 0 0 -30px;
    z-index: 999;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px 10px 10px 10px;
    opacity: 0.9;
}
</pre>
<p>And that was all the style. Now, let&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>Let&#8217;s define our template function:</p>
<pre class="brush:js">
var $ibWrapper	= $('#ib-main-wrapper'),

	Template	= (function() {
		...
})();

Template.init();
</pre>
<p>First, we will set some variables and cache some elements:</p>
<pre class="brush:js">
var kinetic_moving				= false,
	// current index of the opened item
	current						= -1,
	// true if the item is being opened / closed
	isAnimating					= false,
	// items on the grid
	$ibItems					= $ibWrapper.find('div.ib-main &gt; a'),
	// image items on the grid
	$ibImgItems					= $ibItems.not('.ib-content'),
	// total image items on the grid
	imgItemsCount				= $ibImgItems.length,
</pre>
<p>The init function will add a class to all the image items and call the jQuery.kinetic plugin and initialize our main events:</p>
<pre class="brush:js">
init						= function() {

		// add a class ib-image to the image items
		$ibImgItems.addClass('ib-image');
		// apply the kinetic plugin to the wrapper
		loadKinetic();
		// load some events
		initEvents();

	},
</pre>
<p><strong>loadKinetic</strong> will set the size of the main wrapper and apply the jQuery.kinetic plugin:</p>
<pre class="brush:js">
loadKinetic					= function() {

	setWrapperSize();

	$ibWrapper.kinetic({
		moved	: function() {

			kinetic_moving = true;

		},
		stopped	: function() {

			kinetic_moving = false;

		}
	});

},
</pre>
<p><strong>setWrapperSize</strong> will set the height of the main wrapper by taking the window height and removing the top bar and the bottom bar (which is our demo header actually):</p>
<pre class="brush:js">
setWrapperSize				= function() {

	var containerMargins	= $('#ib-top').outerHeight(true) + $('#header').outerHeight(true) + parseFloat( $ibItems.css('margin-top') );
	$ibWrapper.css( 'height', $(window).height() - containerMargins )

},
</pre>
<p><strong>initEvents</strong> calls the openItem function when we click on a box (unless we are dragging) and takes care of the resizing when we change the window size:</p>
<pre class="brush:js">
initEvents					= function() {

	// open the item only if not dragging the container
	$ibItems.bind('click.ibTemplate', function( event ) {

		if( !kinetic_moving )
			openItem( $(this) );

		return false;	

	});

	// on window resize, set the wrapper and preview size accordingly
	$(window).bind('resize.ibTemplate', function( event ) {

		setWrapperSize();

		$('#ib-img-preview, #ib-content-preview').css({
			width	: $(window).width(),
			height	: $(window).height()
		})

	});

},
</pre>
<p>When we click on an item, depending on which item we clicked, we&#8217;ll load a full image or a content area:</p>
<pre class="brush:js">
openItem					= function( $item ) {

	if( isAnimating ) return false;

	// if content item
	if( $item.hasClass('ib-content') ) {

		isAnimating	= true;
		current	= $item.index('.ib-content');
		loadContentItem( $item, function() { isAnimating = false; } );

	}
	// if image item
	else {

		isAnimating	= true;
		current	= $item.index('.ib-image');
		loadImgPreview( $item, function() { isAnimating = false; } );

	}

},
</pre>
<p>If we click on a thumbnail, we&#8217;ll load and expand to the respective large image. We will use the jQuery template for the large image preview and set it to the same position like the currently clicked item. Initially having the same size, it will then expand first in width to fit the window and then in height:</p>
<pre class="brush:js">
loadImgPreview				= function( $item, callback ) {

	var largeSrc		= $item.children('img').data('largesrc'),
		description		= $item.children('span').text(),
		largeImageData	= {
			src			: largeSrc,
			description	: description
		};

	// preload large image
	$item.addClass('ib-loading');

	preloadImage( largeSrc, function() {

		$item.removeClass('ib-loading');

		var hasImgPreview	= ( $('#ib-img-preview').length &gt; 0 );

		if( !hasImgPreview )
			$('#previewTmpl').tmpl( largeImageData ).insertAfter( $ibWrapper );
		else
			$('#ib-img-preview').children('img.ib-preview-img').attr( 'src', largeSrc );

		//get dimentions for the image, based on the windows size
		var	dim	= getImageDim( largeSrc );

		$item.removeClass('ib-img-loading');

		//set the returned values and show/animate preview
		$('#ib-img-preview').css({
			width	: $item.width(),
			height	: $item.height(),
			left	: $item.offset().left,
			top		: $item.offset().top
		}).children('img.ib-preview-img').hide().css({
			width	: dim.width,
			height	: dim.height,
			left	: dim.left,
			top		: dim.top
		}).fadeIn( 400 ).end().show().animate({
			width	: $(window).width(),
			left	: 0
		}, 500, 'easeOutExpo', function() {

			$(this).animate({
				height	: $(window).height(),
				top		: 0
			}, 400, function() {

				var $this	= $(this);
				$this.find('span.ib-preview-descr, span.ib-close').show()
				if( imgItemsCount &gt; 1 )
					$this.find('div.ib-nav').show();

				if( callback ) callback.call();

			});

		});

		if( !hasImgPreview )
			initImgPreviewEvents();

	} );

},
</pre>
<p>With the same effect of expanding, we&#8217;ll open a content area, too. Here we have to take care of the text elements:</p>
<pre class="brush:js">
loadContentItem				= function( $item, callback ) {

	var hasContentPreview	= ( $('#ib-content-preview').length &gt; 0 ),
		teaser				= $item.children('div.ib-teaser').html(),
		content				= $item.children('div.ib-content-full').html(),
		contentData			= {
			teaser		: teaser,
			content		: content
		};

	if( !hasContentPreview )
		$('#contentTmpl').tmpl( contentData ).insertAfter( $ibWrapper );

	//set the returned values and show/animate preview
	$('#ib-content-preview').css({
		width	: $item.width(),
		height	: $item.height(),
		left	: $item.offset().left,
		top		: $item.offset().top
	}).show().animate({
		width	: $(window).width(),
		left	: 0
	}, 500, 'easeOutExpo', function() {

		$(this).animate({
			height	: $(window).height(),
			top		: 0
		}, 400, function() {

			var $this	= $(this),
				$teaser	= $this.find('div.ib-teaser'),
				$content= $this.find('div.ib-content-full'),
				$close	= $this.find('span.ib-close');

			if( hasContentPreview ) {
				$teaser.html( teaser )
				$content.html( content )
			}

			$teaser.show();
			$content.show();
			$close.show();

			if( callback ) callback.call();

		});

	});

	if( !hasContentPreview )
		initContentPreviewEvents();	

},
</pre>
<p>A little helper function for preloading images:</p>
<pre class="brush:js">
// preloads an image
preloadImage				= function( src, callback ) {

	$('&lt;img/&gt;').load(function(){

		if( callback ) callback.call();

	}).attr( 'src', src );

},
</pre>
<p>The next function takes care of loading the events for the large image preview : navigation, close button, and window resize:</p>
<pre class="brush:js">
initImgPreviewEvents		= function() {

	var $preview	= $('#ib-img-preview');

	$preview.find('span.ib-nav-prev').bind('click.ibTemplate', function( event ) {

		navigate( 'prev' );

	}).end().find('span.ib-nav-next').bind('click.ibTemplate', function( event ) {

		navigate( 'next' );

	}).end().find('span.ib-close').bind('click.ibTemplate', function( event ) {

		closeImgPreview();

	});

	//resizing the window resizes the preview image
	$(window).bind('resize.ibTemplate', function( event ) {

		var $largeImg	= $preview.children('img.ib-preview-img'),
			dim			= getImageDim( $largeImg.attr('src') );

		$largeImg.css({
			width	: dim.width,
			height	: dim.height,
			left	: dim.left,
			top		: dim.top
		})

	});

},
</pre>
<p>For the content preview we&#8217;ll also have to load the event for the closing functionality:</p>
<pre class="brush:js">
initContentPreviewEvents	= function() {

	$('#ib-content-preview').find('span.ib-close').bind('click.ibTemplate', function( event ) {

		closeContentPreview();

	});

},
</pre>
<p>Next, we&#8217;ll define the function that takes care of navigating through the large images in fullscreen:</p>
<pre class="brush:js">
// navigate the image items in fullscreen mode
navigate					= function( dir ) {

	if( isAnimating ) return false;

	isAnimating		= true;

	var $preview	= $('#ib-img-preview'),
		$loading	= $preview.find('div.ib-loading-large');

	$loading.show();

	if( dir === 'next' ) {

		( current === imgItemsCount - 1 ) ? current	= 0 : ++current;

	}
	else if( dir === 'prev' ) {

		( current === 0 ) ? current	= imgItemsCount - 1 : --current;

	}

	var $item		= $ibImgItems.eq( current ),
		largeSrc	= $item.children('img').data('largesrc'),
		description	= $item.children('span').text();

	preloadImage( largeSrc, function() {

		$loading.hide();

		//get dimentions for the image, based on the windows size
		var	dim	= getImageDim( largeSrc );

		$preview.children('img.ib-preview-img')
						.attr( 'src', largeSrc )
						.css({
			width	: dim.width,
			height	: dim.height,
			left	: dim.left,
			top		: dim.top
						})
						.end()
						.find('span.ib-preview-descr')
						.text( description );

		$ibWrapper.scrollTop( $item.offset().top )
				  .scrollLeft( $item.offset().left );

		isAnimating	= false;

	});

},
</pre>
<p>The following function is for closing the fullscreen image preview:</p>
<pre class="brush:js">

closeImgPreview				= function() {

	if( isAnimating ) return false;

	isAnimating	= true;

	var $item	= $ibImgItems.eq( current );

	$('#ib-img-preview').find('span.ib-preview-descr, div.ib-nav, span.ib-close')
					.hide()
					.end()
					.animate({
						height	: $item.height(),
						top		: $item.offset().top
						}, 500, 'easeOutExpo', function() {

						$(this).animate({
							width	: $item.width(),
							left	: $item.offset().left
							}, 400, function() {

								$(this).fadeOut(function() {isAnimating	= false;});

						} );

					});

},
</pre>
<p>For the content preview we will also need such a function:</p>
<pre class="brush:js">
// closes the fullscreen content item
closeContentPreview			= function() {

	if( isAnimating ) return false;

	isAnimating	= true;

	var $item	= $ibItems.not('.ib-image').eq( current );

	$('#ib-content-preview').find('div.ib-teaser, div.ib-content-full, span.ib-close')
							.hide()
							.end()
							.animate({
								height	: $item.height(),
								top		: $item.offset().top
							}, 500, 'easeOutExpo', function() {

								$(this).animate({
									width	: $item.width(),
									left	: $item.offset().left
								}, 400, function() {

									$(this).fadeOut(function() {isAnimating	= false;});

								} );

							});

},
</pre>
<p><strong>getImageDim</strong> will get the size of an image and make it centered in fullscreen:</p>
<pre class="brush:js">
getImageDim					= function( src ) {

	var img     	= new Image();
	img.src     	= src;

	var w_w	= $(window).width(),
		w_h	= $(window).height(),
		r_w	= w_h / w_w,
		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 &gt; r_i ) {

		new_h	= w_h;
		new_w	= w_h / r_i;

	}
	else {

		new_h	= w_w * r_i;
		new_w	= w_w;

	}

	return {
		width	: new_w,
		height	: new_h,
		left	: (w_w - new_w) / 2,
		top		: (w_h - new_h) / 2
	};

};
</pre>
<p>And that&#8217;s it! I hope you enjoyed making this template with me and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/DraggableImageBoxesGrid/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/DraggableImageBoxesGrid/DraggableImageBoxesGrid.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/10/07/draggable-image-boxes-grid/feed/</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
		<item>
		<title>Multi-level Photo Map</title>
		<link>http://tympanus.net/codrops/2011/09/27/multi-level-photo-map/</link>
		<comments>http://tympanus.net/codrops/2011/09/27/multi-level-photo-map/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 11:37:04 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[thumbnails]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=5879</guid>
		<description><![CDATA[This multi-level map based image gallery makes it possible to show images related to their location. The first level indicates the location of the places where each one has a set of images, and the second level shows each single image and its location. Using Google Maps, we'll have the location shown on the left side while the images of a location are shown on the right. The images can be viewed in medium size mode or in full lightbox-like mode. The map has a fullscreen option which will show the thumbnails of the images in their location.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/MultiLevelPhotoMap/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/09/MultiLevelPhotoMap.jpg" alt="" title="MultiLevelPhotoMap" width="580" height="315" class="aligncenter size-full wp-image-5891" /></a><br />
<a class="demo" href="http://tympanus.net/Development/MultiLevelPhotoMap/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Development/MultiLevelPhotoMap/MultiLevelPhotoMap.zip">Download source</a><br />
This multi-level map based image gallery makes it possible to show images related to their location. The first level indicates the location of the places where each one has a set of images, and the second level shows each single image and its location. Using Google Maps, we&#8217;ll have the location shown on the left side while the images of a location are shown on the right. The images can be viewed in medium size mode or in full lightbox-like mode. The map has a fullscreen option which will show the thumbnails of the images in their location.</p>
<p>The images used in the demo are by <a title="Flickr Photostream of Davidd" href="http://www.flickr.com/people/puuikibeach/" target="_blank">Davidd</a>. They are licensed under the <a title="Attribution 2.0 Generic (CC BY 2.0)" href="http://creativecommons.org/licenses/by/2.0/deed.en_GB" target="_blank">Attribution 2.0 Generic (CC BY 2.0) License</a>.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>How it works</h3>
<p>The locations for the images are saved in the album.xml file which has the following stucture:</p>
<pre class="brush:xml">
&lt;album&gt;
	&lt;name&gt;Thailand 2011&lt;/name&gt;
	&lt;description&gt;Some description&lt;/description&gt;
	&lt;places&gt;
	...
	&lt;/places&gt;
&lt;/album&gt;
</pre>
<p>Inside of the places, we&#8217;ll have the information of each place with its name and location and all the single photos in that place:</p>
<pre class="brush:xml">
&lt;place&gt;
	&lt;name&gt;Bangkok&lt;/name&gt;
	&lt;location&gt;
		&lt;lat&gt;13.696693336737654&lt;/lat&gt;
		&lt;lng&gt;100.57159423828125&lt;/lng&gt;
	&lt;/location&gt;
	&lt;photos&gt;
		&lt;photo&gt;
			&lt;thumb&gt;photos/Bangkok/thumbs/1.jpg&lt;/thumb&gt;
			&lt;source&gt;photos/Bangkok/1.jpg&lt;/source&gt;
			&lt;description&gt;Some description&lt;/description&gt;
			&lt;location&gt;
				&lt;lat&gt;13.710035342476681&lt;/lat&gt;
				&lt;lng&gt;100.52043914794922&lt;/lng&gt;
			&lt;/location&gt;
		&lt;/photo&gt;
		&lt;photo&gt;
			...
		&lt;/photo&gt;
	&lt;/photos&gt;
&lt;/place&gt;
</pre>
<p>Besides the path to its thumbnail and the full image, every photo has a location in latitude and longitude as well.</p>
<p>Note, that we are using some PHP here in order to load and retrieve the XML data, so you&#8217;ll need a server environment to run this.</p>
<p>Initially, a map with all the places is shown:<br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2011/09/MultiLevelPhotoMap_01.jpg" alt="" title="MultiLevelPhotoMap_01" width="580" height="264" class="aligncenter size-full wp-image-5882" /><br />
In our example it is Bangkok, Phuket and Myeik. In the bar under the map and the preview area, we will have the name and the description of the whole album. In this stage we can already go fullscreen in order to see the full map with the places.</p>
<p>Back in the normal mode, when choosing a place, all the images of that place will show on the right side while we zoom the map in on the left side. As you can see, whenever you hover over a photo, you will see its location on the map and vice versa:<br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2011/09/MultiLevelPhotoMap_02.jpg" alt="" title="MultiLevelPhotoMap_02" width="580" height="265" class="aligncenter size-full wp-image-5883" /></p>
<p>When clicking on a thumbnail or the camera icon on the map, we open the preview for the images, through which we can also navigate:</p>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/09/MultiLevelPhotoMap_03.jpg" alt="" title="MultiLevelPhotoMap_03" width="580" height="265" class="aligncenter size-full wp-image-5884" /></p>
<p>Clicking on the zoom icon of the preview image will open the large lightbox-like view of the full image:</p>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/09/MultiLevelPhotoMap_04.jpg" alt="" title="MultiLevelPhotoMap_04" width="580" height="311" class="aligncenter size-full wp-image-5885" /></p>
<p>When we are in the second level and open the fullscreen mode, we can see the thumbnails in the map:<br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2011/09/MultiLevelPhotoMap_05.jpg" alt="" title="MultiLevelPhotoMap_05" width="580" height="311" class="aligncenter size-full wp-image-5886" /></p>
<p>Hope you find it useful, feedback is welcome!</p>
<p><a class="demo" href="http://tympanus.net/Development/MultiLevelPhotoMap/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Development/MultiLevelPhotoMap/MultiLevelPhotoMap.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/09/27/multi-level-photo-map/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Responsive Image Gallery with Thumbnail Carousel</title>
		<link>http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/</link>
		<comments>http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 23:54:06 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[responsive]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=5762</guid>
		<description><![CDATA[A tutorial on how to create a responsive image gallery with a thumbnail carousel using Elastislide. Inspired by Twitter's "user gallery" and upon a request to show an integration of Elastislide, we want to implement a responsive gallery that adapts to the view-port width. The gallery will have a view switch that allows to view it with the thumbnail carousel or without. We'll also add the possibility to navigate with the keyboard.]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://tympanus.net/Tutorials/ResponsiveImageGallery/"><img class="aligncenter size-full wp-image-5776" title="Responsive Image Gallery" src="http://tympanus.net/codrops/wp-content/uploads/2011/09/ResponsiveImageGallery.jpg" alt="" width="580" height="315" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/ResponsiveImageGallery/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ResponsiveImageGallery/ResponsiveImageGallery.zip">Download source</a></p>
<p>Today we want to show you how to create a responsive image gallery with a thumbnail carousel using <a title="Elastislide – A Responsive jQuery Carousel Plugin" href="http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/" target="_blank">Elastislide</a>. Inspired by Twitter&#8217;s &#8220;user gallery&#8221; and upon a request to show an integration of Elastislide, we want to implement a responsive gallery that adapts to the view-port width. The gallery will have a view switch that allows to view it with the thumbnail carousel or without. We&#8217;ll also add the possibility to navigate with the keyboard.</p>
<p>We&#8217;ll use the <a href="http://www.netcu.de/jquery-touchwipe-iphone-ipad-library" target="_blank">jQuery Touchwipe Plugin</a> that will make it possible to navigate the images by &#8220;wiping&#8221; on the iPhone and iPad.</p>
<p>The images in the demo are by über-talented Sherman Geronimo-Tan and you can find his Flickr photostream here: <a href="http://www.flickr.com/photos/smanography/" target="_blank">Sherman Geronimo-Tan&#8217;s Flickr Photostream</a><br />
The photos are licensed under the <a href="http://creativecommons.org/licenses/by/2.0/deed.en_GB" target="_blank">Creative Commons Attribution 2.0 Generic (CC BY 2.0) License</a>.</p>
<p>So, let&#8217;s do it!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>For the HTML structure we&#8217;ll have a main wrapper with the class &#8220;rg-gallery&#8221;. We&#8217;ll also give it the same ID. In another div with the class &#8220;rg-thumbs&#8221; we&#8217;ll add the structure of the Elastislide carousel:</p>
<pre class="brush:xml">
&lt;div id="rg-gallery" class="rg-gallery"&gt;
	&lt;div class="rg-thumbs"&gt;
		&lt;!-- Elastislide Carousel Thumbnail Viewer --&gt;
		&lt;div class="es-carousel-wrapper"&gt;
			&lt;div class="es-nav"&gt;
				&lt;span class="es-nav-prev"&gt;Previous&lt;/span&gt;
				&lt;span class="es-nav-next"&gt;Next&lt;/span&gt;
			&lt;/div&gt;
			&lt;div class="es-carousel"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						&lt;a href="#"&gt;
							&lt;img src="images/thumbs/1.jpg" data-large="images/1.jpg" alt="image01" data-description="Some description" /&gt;
						&lt;/a&gt;
					&lt;/li&gt;
					&lt;li&gt;...&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		&lt;!-- End Elastislide Carousel Thumbnail Viewer --&gt;
	&lt;/div&gt;&lt;!-- rg-thumbs --&gt;
&lt;/div&gt;&lt;!-- rg-gallery --&gt;
</pre>
<p>The thumbnails will have two data attributes that we&#8217;ll use later in our JavaScript. The &#8220;data-large&#8221; attribute will have the path to the large image and the &#8220;data-description&#8221; attribute will contain the caption of the image that we will display under the current large image.</p>
<p>For the structure of the large preview area we will create a jQuery template that we&#8217;ll add to the head of our document:</p>
<pre class="brush:xml">
&lt;script id="img-wrapper-tmpl" type="text/x-jquery-tmpl"&gt;
	&lt;div class="rg-image-wrapper"&gt;
		{{if itemsCount &gt; 1}}
			&lt;div class="rg-image-nav"&gt;
				&lt;a href="#" class="rg-image-nav-prev"&gt;Previous Image&lt;/a&gt;
				&lt;a href="#" class="rg-image-nav-next"&gt;Next Image&lt;/a&gt;
			&lt;/div&gt;
		{{/if}}
		&lt;div class="rg-image"&gt;&lt;/div&gt;
		&lt;div class="rg-loading"&gt;&lt;/div&gt;
		&lt;div class="rg-caption-wrapper"&gt;
			&lt;div class="rg-caption" style="display:none;"&gt;
				&lt;p&gt;&lt;/p&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/script&gt;
</pre>
<p>We are adding a condition that will make sure that the navigation is only shown if there is more than one image. The &#8220;rg-image&#8221; container will be used to add the large image.</p>
<p>Let&#8217;s take a look at the style.</p>
<h3>The CSS</h3>
<p>Besides adjusting a few values like the padding and the margins of the Elastislide thumbnail carousel, we need to style the resting elements of the gallery.</p>
<p>The &#8220;rg-image-wrapper&#8221; that you saw in our jQuery template will be of relative position and we&#8217;ll add a repeated semi-transparent black background image. The borders will be rounded and we&#8217;ll give it a min-height of 20 pixels so that the loading element fits into the container initially when the first image get&#8217;s loaded:</p>
<pre class="brush:css">
.rg-image-wrapper{
	position:relative;
	padding:20px 30px;
	background:transparent url(../images/black.png) repeat top left;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	min-height:20px;
}
</pre>
<p>The container that we&#8217;ll use to add the big image will be relative and have a line-height of 0. By adding text-align &#8220;center&#8221; we make all inline elements align in the center. But since we&#8217;ll not set the image to &#8220;display:block&#8221;, we need to add a line-height of 0. This will make sure that there is no gap under the image which is an inline-element by default:</p>
<pre class="brush:css">
.rg-image{
	position:relative;
	text-align:center;
	line-height:0px;
}
</pre>
<p>By setting the max-width of our large image to 100%, we make sure that it will always stay in the surrounding fluid container. This is very nicely explained in <a href="http://www.alistapart.com/articles/fluid-images/" target="_blank">Fluid Images</a> by Ethan Marcotte on A List Apart.<br />
Now, why setting the max-height to 100% as well? We actually don&#8217;t need this but if you would like to restrict the size of the preview area you could set a fixed height for the &#8220;rg-image&#8221; class and the image would fit in it while still resizing when the width of the view-port changes.</p>
<pre class="brush:css">
.rg-image img{
	max-height:100%;
	max-width:100%;
}
</pre>
<p>Let&#8217;s style the navigation elements. The style of the arrow anchors will be the following:</p>
<pre class="brush:css">
.rg-image-nav a{
	position:absolute;
	top:0px;
	left:0px;
	background:#000 url(../images/nav.png) no-repeat -20% 50%;
	width:28px;
	height:100%;
	text-indent:-9000px;
	cursor:pointer;
	opacity:0.3;
	outline:none;
	-moz-border-radius: 10px 0px 0px 10px;
	-webkit-border-radius: 10px 0px 0px 10px;
	border-radius: 10px 0px 0px 10px;
}
</pre>
<p>This is actually the style of the left arrow and now we&#8217;ll overwrite some properties for the right arrow:</p>
<pre class="brush:css">
.rg-image-nav a.rg-image-nav-next{
	right:0px;
	left:auto;
	background-position:115% 50%;
	-moz-border-radius: 0px 10px 10px 0px;
	-webkit-border-radius: 0px 10px 10px 0px;
	border-radius: 0px 10px 10px 0px;
}
</pre>
<p>Since we already defined the left value for the elements in general we need to set it to auto again if we want to use &#8220;right&#8221; instead.</p>
<p>On hover we want to make them more opaque:</p>
<pre class="brush:css">
.rg-image-nav a:hover{
	opacity:0.8;
}
</pre>
<p>The caption will have the following style:</p>
<pre class="brush:css">
.rg-caption {
	text-align:center;
	margin-top:15px;
	position:relative;
}
.rg-caption p{
	font-size:11px;
	letter-spacing:2px;
	font-family: 'Trebuchet MS', 'Myriad Pro', Arial, sans-serif;
	line-height:16px;
	padding:0 15px;
	text-transform:uppercase;
}
</pre>
<p>Now, let&#8217;s style the switch options:</p>
<pre class="brush:css">
.rg-view{
	height:30px;
}
.rg-view a{
	display:block;
	float:right;
	width:16px;
	height:16px;
	margin-right:3px;
	background:#464646 url(../images/views.png) no-repeat top left;
	border:3px solid #464646;
	opacity:0.8;
}
.rg-view a:hover{
	opacity:1.0;
}
.rg-view a.rg-view-full{
	background-position:0px 0px;
}
.rg-view a.rg-view-selected{
	background-color:#6f6f6f;
	border-color:#6f6f6f;
}
.rg-view a.rg-view-thumbs{
	background-position:0px -16px;
}
</pre>
<p>And finally, we&#8217;ll make the loading element appear in the center of the image preview:</p>
<pre class="brush:css">
.rg-loading{
	width:46px;
	height:46px;
	position:absolute;
	top:50%;
	left:50%;
	background:#000 url(../images/ajax-loader.gif) no-repeat center center;
	margin:-23px 0px 0px -23px;
	z-index:100;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	opacity:0.7;
}
</pre>
<p>And that&#8217;s all the style! Let&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>The main idea of the gallery is to make it flexible, so partly we have achieved that by our style: the large image will adjust to the container. For making the thumbnail carousel responsive, we&#8217;ll use Elastislide, our previous plugin.<br />
First, lets define some variables:</p>
<pre class="brush:js">
	// gallery container
var $rgGallery			= $('#rg-gallery'),
	// carousel container
	$esCarousel			= $rgGallery.find('div.es-carousel-wrapper'),
	// the carousel items
	$items				= $esCarousel.find('ul &gt; li'),
	// total number of items
	itemsCount			= $items.length;
</pre>
<p>Then we&#8217;ll define our gallery function:</p>
<pre class="brush:js">
	Gallery				= (function() {
		//gallery function
	})();

Gallery.init();
</pre>
<p>Here we&#8217;ll define some variables for the current image, the mode and a variable for controlling if an image is being loaded. Then we&#8217;ll call some of our functions that are following below:</p>
<pre class="brush:js">
var current			= 0,
	// mode : carousel || fullview
	mode 			= 'carousel',
	// control if one image is being loaded
	anim			= false,
	init			= function() {

		// (not necessary) preloading the images here...
		$items.add('&lt;img src="images/ajax-loader.gif"/&gt;&lt;img src="images/black.png"/&gt;').imagesLoaded( function() {
			// add options
			_addViewModes();

			// add large image wrapper
			_addImageWrapper();

			// show first image
			_showImage( $items.eq( current ) );
		});

		// initialize the carousel
		_initCarousel();

	},
</pre>
<p>We need to call the Elastislide plugin:</p>
<pre class="brush:js">
_initCarousel	= function() {
	$esCarousel.show().elastislide({
		imageW 	: 65,
		onClick	: function( $item ) {
			if( anim ) return false;
			anim	= true;
			// on click show image
			_showImage($item);
			// change current
			current	= $item.index();
		}
	});

	// set elastislide's current to current
	$esCarousel.elastislide( 'setCurrent', current );

},
</pre>
<p>Read more about Elastislide&#8217;s options here: <a href="http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/" target="_blank">Elastislide – A Responsive jQuery Carousel Plugin</a>.</p>
<p>Our next function will take care of the viewing modes and what happens when we switch the views:</p>
<pre class="brush:js">
_addViewModes	= function() {

	// top right buttons: hide / show carousel

	var $viewfull	= $('&lt;a href="#" class="rg-view-full"&gt;&lt;/a&gt;'),
		$viewthumbs	= $('&lt;a href="#" class="rg-view-thumbs rg-view-selected"&gt;&lt;/a&gt;');

	$rgGallery.prepend( $('&lt;div class="rg-view"/&gt;').append( $viewfull ).append( $viewthumbs ) );

	$viewfull.bind('click.rgGallery', function( event ) {
		$esCarousel.elastislide( 'destroy' ).hide();
		$viewfull.addClass('rg-view-selected');
		$viewthumbs.removeClass('rg-view-selected');
		mode	= 'fullview';
		return false;
	});

	$viewthumbs.bind('click.rgGallery', function( event ) {
		_initCarousel();
		$viewthumbs.addClass('rg-view-selected');
		$viewfull.removeClass('rg-view-selected');
		mode	= 'carousel';
		return false;
	});

},
</pre>
<p>The <strong>_addImageWrapper</strong> function adds the structure for the large image and the navigation buttons if the number of total items is greater than one.<br />
It also initializes the navigation events. Using the jQuery Touchwipe Plugin, we&#8217;ll add support for the wipe gesture and also for keyboard navigation:</p>
<pre class="brush:js">
_addImageWrapper= function() {

	$('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ).appendTo( $rgGallery );

	if( itemsCount &gt; 1 ) {
		// addNavigation
		var $navPrev		= $rgGallery.find('a.rg-image-nav-prev'),
			$navNext		= $rgGallery.find('a.rg-image-nav-next'),
			$imgWrapper		= $rgGallery.find('div.rg-image');

		$navPrev.bind('click.rgGallery', function( event ) {
			_navigate( 'left' );
			return false;
		});	

		$navNext.bind('click.rgGallery', function( event ) {
			_navigate( 'right' );
			return false;
		});

		// add touchwipe events on the large image wrapper
		$imgWrapper.touchwipe({
			wipeLeft			: function() {
				_navigate( 'right' );
			},
			wipeRight			: function() {
				_navigate( 'left' );
			},
			preventDefaultEvents: false
		});

		$(document).bind('keyup.rgGallery', function( event ) {
			if (event.keyCode == 39)
				_navigate( 'right' );
			else if (event.keyCode == 37)
				_navigate( 'left' );
		});

	}

},
</pre>
<p>The navigation through the large images is controlled by the following function:</p>
<pre class="brush:js">
_navigate		= function( dir ) {

	if( anim ) return false;
	anim	= true;

	if( dir === 'right' ) {
		if( current + 1 &gt;= itemsCount )
			current = 0;
		else
			++current;
	}
	else if( dir === 'left' ) {
		if( current - 1 &lt; 0 )
			current = itemsCount - 1;
		else
			--current;
	}

	_showImage( $items.eq( current ) );

},
</pre>
<p>Depening in which direction we are moving, we are setting the current element to one less or one more.</p>
<p>And finally we&#8217;ll define the <strong>_showImage</strong> function that will add the large image and its caption:</p>
<pre class="brush:js">
_showImage		= function( $item ) {

	// shows the large image that is associated to the $item

	var $loader	= $rgGallery.find('div.rg-loading').show();

	$items.removeClass('selected');
	$item.addClass('selected');

	var $thumb		= $item.find('img'),
		largesrc	= $thumb.data('large'),
		title		= $thumb.data('description');

	$('&lt;img/&gt;').load( function() {

		$rgGallery.find('div.rg-image').empty().append('&lt;img src="' + largesrc + '"/&gt;');

		if( title )
			$rgGallery.find('div.rg-caption').show().children('p').empty().text( title );

		$loader.hide();

		if( mode === 'carousel' ) {
			$esCarousel.elastislide( 'reload' );
			$esCarousel.elastislide( 'setCurrent', current );
		}

		anim	= false;

	}).attr( 'src', largesrc );

};

return { init : init };
</pre>
<p>And that&#8217;s all folks! I hope you enjoyed this gallery tutorial and find it useful!<br />
<a class="demo" href="http://tympanus.net/Tutorials/ResponsiveImageGallery/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ResponsiveImageGallery/ResponsiveImageGallery.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/feed/</wfw:commentRss>
		<slash:comments>159</slash:comments>
		</item>
		<item>
		<title>Fullscreen Slideshow with HTML5 Audio and jQuery</title>
		<link>http://tympanus.net/codrops/2011/07/05/fullscreen-slideshow-with-html5-audio/</link>
		<comments>http://tympanus.net/codrops/2011/07/05/fullscreen-slideshow-with-html5-audio/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 11:31:25 +0000</pubDate>
		<dc:creator>Jay Salvat</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=4950</guid>
		<description><![CDATA[In today’s tutorial we'll create a fullscreen photo slideshow to illustrate a New York picture series. We will add sounds with the HTML5 audio element in order to give life to the gallery and try to recreate the ambient of this vibrant city.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/FullscreenSlideshowAudio/" target="_blank"><img class="aligncenter size-full wp-image-5021" title="fullscreenSlideshowHtml5" src="http://tympanus.net/codrops/wp-content/uploads/2011/07/fullscreenSlideshowHtml5.jpg" alt="" width="580" height="315" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FullscreenSlideshowAudio/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/FullscreenSlideshowAudio/FullscreenSlideshowAudio.zip">Download source</a></p>
<p>In today’s tutorial we&#8217;ll create a fullscreen photo slideshow to illustrate a New York picture series. We will add sounds with the HTML5 audio element in order to give life to the gallery and try to recreate the ambient of this vibrant city.</p>
<p>To create the slideshow and the fullscreen picture display, we&#8217;ll use the <a href="http://vegas.jaysalvat.com/" target="_blank">Vegas jQuery plugin</a> that compiles many ideas previously shared in Codrops articles in one plugin. The audio elements will be controlled with <a href="http://buzz.jaysalvat.com">Buzz, a JavaScript audio library</a>. You can find out more about these two plugins that I wrote on my website: <a href="http://jaysalvat.com">Jay Salvat&#8217;s website</a>.</p>
<p>The thumbnails navigation will be spiced up with a custom scrollbar using <a href="http://jscrollpane.kelvinluck.com/" target="_blank">jScrollPane</a> by <a href="http://www.kelvinluck.com/" target="_blank">Kelvin Luck</a> and some easing effects provided by the <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">jQuery easing</a> plugin by <a href="http://gsgd.co.uk/freelance/" target="_blank">George McGinley Smith</a>.</p>
<p>The New York photography is by <a href="http://www.flickr.com/photos/48904316@N04/" target="_blank">Alessandro Artini</a>, check out his photos on his <a href="http://www.flickr.com/photos/48904316@N04/" target="_blank">Flickr photostream</a>.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>Let&#8217;s set the stage! First we create a placeholder to contain the picture title and credits.</p>
<pre class="brush:xml">&lt;div id="title"&gt;
    &lt;h1&gt;New York Gallery&lt;/h1&gt;
    &lt;p&gt;Pictures by &lt;a href="http://www.flickr.com/"&gt;Alessandro Artini&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</pre>
<p>Then the thumbnails are placed in an unordered list. Each thumbnail is linked to a big representation of the picture and carry the title of the picture. Note that we add a data attribute to some links to adjust the vertical alignment of the displayed fullscreen picture to avoid cropping an important part.</p>
<p>Two empty divs are added to hold the pointer and the flash effect when the slides change.</p>
<pre class="brush:xml">&lt;div id="flash"&gt;&lt;/div&gt;
&lt;div id="thumbnails"&gt;
  &lt;ul&gt;
    &lt;li&gt;
      &lt;a href="01.jpg"&gt;
        &lt;img src="01b.jpg" title="New York moving" data-valign="top"&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href="02.jpg"&gt;
        &lt;img src="02b.jpg" title="New York traffic" data-valign="bottom"&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href="03.jpg"&gt;
        &lt;img src="03b.jpg" title="Street dancers"&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    ...
    &lt;/ul&gt;
    &lt;div id="pointer"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>Finally, we place the links for the pause and volume management.</p>
<pre class="brush:xml">&lt;div id="pause"&gt;&lt;a href="#"&gt;Paused&lt;/a&gt;&lt;/div&gt;

&lt;div id="volume"&gt;&lt;a href="#"&gt;Sounds&lt;/a&gt;&lt;/div&gt;</pre>
<h3>The CSS</h3>
<p>First, we&#8217;ll define the style of the title part which is placed at the bottom of the screen with a black background. We use the &#8220;rgba&#8221; notation which allow us to set the opacity of the color. Note that we prepend it by the standard hex notation #000 for older browsers.</p>
<p>The heading will be in the nice Ultra font from the <a href="http://www.google.com/webfonts" target="_blank">Google fonts collection</a>:</p>
<pre class="brush:css">#title {
    background: #000;
    background: rgba(0, 0, 0, 0.8);
    bottom: 0px;
    font: 11px Arial, Helvetica, sans-serif;
    padding: 10px 20px;
    position: fixed;
    right: 0px;
    text-align: right;
    width: 100%;
}
    #title h1 {
        font: 30px 'Ultra', Arial, serif;
        margin: 0;
        padding: 0;
    }</pre>
<p>We&#8217;ll follow the same technique for the thumbnails. The elements of the list are floated to display the pictures as an horizontal bar.</p>
<pre class="brush:css">#thumbnails {
    background: #000;
    background: rgba(0, 0, 0, 0.8);
    height: 90px;
    left: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    width: 100%;
}
    #thumbnails ul {
        margin: 0;
        padding: 0;
    }
    #thumbnails li {
        float: left;
        list-style: none;
        margin: 5px;
        padding: 0;
    }
    #thumbnails a {
        outline: none;
    }
    #thumbnails img {
        width: 112px;
    }</pre>
<p>The pointer is placed out of the page. It will be animated at the beginning of the slideshow and moved under the currently displayed slide.</p>
<pre class="brush:css">#pointer {
    border: 2px solid #F30;
    cursor: pointer;
    height: 75px;
    left: -100px;
    margin: 3px;
    position: absolute;
    width: 112px;
}</pre>
<p>The flash effect is done with a pure white div fixed over the whole screen. By default it is hidden. It will be shown and faded out dynamically.</p>
<pre class="brush:css">#flash {
    background: #FFF;
    display: none;
    height: 100%;
    position: fixed;
    width: 100%;
}</pre>
<p>The same idea holds for the pause text. It is hidden by default.</p>
<pre class="brush:css">#pause {
    display: none;
    font: 100px 'Ultra', arial, serif;
    height: 100%;
    opacity: 0.4;
    position: absolute;
    text-align: center;
    text-shadow: 0 0 5px #000;
    width: 100%;
}
    #pause a {
        color: #FFF;
        height: 100px;
        left: 50%;
        margin: -50px 0 0 -250px;
        position: absolute;
        text-transform: uppercase;
        top: 50%;
        width: 500px;
    }</pre>
<p>For the volume links we&#8217;ll use some nice icons. The volume button has three states defined by three classes showing different icons. We use the CSS sprites technique to reduce the number of png files loaded. Read more about the <a href="http://css-tricks.com/630-css-image-replacement/" target="_blank">CSS image replacement</a> and <a href="http://css-tricks.com/158-css-sprites/" target="_blank">CSS sprites technique</a> on <a href="http://css-tricks.com/" target="_blank">Css-tricks</a>.</p>
<pre class="brush:css">#volume {
    left: 10px;
    opacity: 0.8;
    position: absolute;
    top: 100px;
}
    #volume a {
    	background: transparent url(../img/icons.png) no-repeat;
    	display: block;
    	height: 30px;
    	text-indent: -9999px;
    	width: 30px;
    }
    #volume.all a {
        background-position: 0 0;
    }
    #volume.some a {
        background-position: -30px 0;
    }
    #volume.none a {
        background-position: -60px 0;
    }</pre>
<p>Finally, we&#8217;ll customize some Vegas default styles to adjust the overlay pattern and the position of the loading indicator.</p>
<pre class="brush:css">.vegas-loading {
    top: auto;
    bottom: 40px;
    left: 40px;
}
.vegas-overlay {
    background-image: url(../js/vegas/overlays/02.png);
}</pre>
<p>And we&#8217;ll also make some adjustments to the jScrollPane default styles in order to get a nice scrollbar fitting our gallery.</p>
<pre class="brush:css">.jspHorizontalBar {
    height: 5px;
}
    .jspHorizontalBar .jspTrack {
         background: #333;
    }
    .jspHorizontalBar .jspDrag {
         background: #666;
         cursor: ew-resize;
    }
#thumbnails:hover .jspHorizontalBar .jspDrag {
    background: #F30;
}</pre>
<h3>The JavaScript</h3>
<p>We are reaching the main part: the JavaScript. Let’s start by caching some elements. The picture array will hold all the slides and their title and vertical alignment.</p>
<pre class="brush:javascript">var pictures = [],
    $pointer = $( '#pointer' ),
    $thumbnails = $( '#thumbnails' ),
    $title = $( '#title' ),
    $pause = $( '#pause' ),
    $flash = $( '#flash' ),
    $volume = $( '#volume' );</pre>
<p>It&#8217;s time to define the sounds of our gallery with Buzz. The HTML5 audio element is now supported by all modern browsers. Sounds are supported in a native way without the need for Flash. Unfortunately, there is not a single audio format supported by all of them. MP3 would have been a good choice, but Firefox doesn&#8217;t support it. We have to convert our sounds to several formats. The best combination is OGG and MP3 formats. To convert our audio elements we used the free online file converter <a href="http://www.online-convert.com/" target="_blank">Online Convert</a>.</p>
<p>Buzz allows us to group sounds in order to easily control them. This is what we do with all the camera sounds.</p>
<p>If the user&#8217;s browser doesn&#8217;t support the HTML5 audio element, Buzz degrades properly. In that case, we&#8217;ll simply hide the volume button.</p>
<p>The traffic sound is played and looped as soon as it is loaded.</p>
<pre class="brush:javascript">buzz.defaults.formats = [ 'ogg', 'mp3' ];

var trafficSound = new buzz.sound( 'sounds/traffic' ),
    clickSound = new buzz.sound( 'sounds/click' ),
    focusSound = new buzz.sound( 'sounds/focus' ),
    rewindSound = new buzz.sound( 'sounds/rewind' ),
    cameraSounds = new buzz.group( clickSound, focusSound, rewindSound );

if ( !buzz.isSupported() ) {
    $volume.hide();
}</pre>
<pre class="brush:javascript">trafficSound.loop().play().fadeIn( 5000 );
</pre>
<p>Now, let&#8217;s work on our thumbnails. We have to adjust the total width of the thumbnails bar. Without this step, the thumbnails would be display in more than one row.</p>
<pre class="brush:javascript">$thumbnails.find( 'ul' ).width( function() {
    var totalWidth = 0;
    $( this ).find( 'li' ).each( function() {
        totalWidth += $( this ).outerWidth( true );
    });
    return totalWidth;
});</pre>
<p>We&#8217;ll now apply jScrollPane to the thumbnails container. jScrollPane provides an easy way to work with its API. We use that in order to render a proper scrollbar when the window is resized. This API will be useful in a further step.</p>
<pre class="brush:javascript">$thumbnails.jScrollPane();

var jScrollPaneApi = $thumbnails.data( 'jsp' );

$( window ).bind( 'resize', function() {
    jScrollPaneApi.reinitialise();
});</pre>
<p>Now, the Vegas plugin needs to be set. We&#8217;ll fill the picture array by grabbing some information from the thumbnails list and pass it to Vegas in order to start the slideshow. A four second delay is applied between the slides.</p>
<pre class="brush:javascript">$thumbnails.find( 'a' ).each( function() {
    pictures.push({
        src: $( this ).attr( 'href' ),
        title: $( this ).find( 'img' ).attr( 'title' ),
        valign: $( this ).find( 'img' ).data( 'valign' )
    });
})

$.vegas( 'slideshow', {
    backgrounds: pictures,
    delay: 4000
 })( 'overlay' );</pre>
<p>Vegas triggers a bunch of events. The one we need now is the onload event trigger when a slide is loaded and displayed. With the src attribute of the loaded image, we&#8217;ll get the number of the currently active thumbnail. Also, a sound is played.</p>
<pre class="brush:javascript">$( 'body' ).bind( 'vegasload', function( e, img ) {
    var src = $( img ).attr( 'src' ),
        idx = $( 'a[href="' + src + '"]' ).parent( 'li' ).index();</pre>
<pre class="brush:javascript">    focusSound.play();

    // ...
});</pre>
<p>The title is modified in order to hold the picture title and is displayed with a nice fade-out/fade-in effect.</p>
<pre class="brush:javascript">    $title.fadeOut( function() {
        $( this ).find( 'h1' ).text( pictures[ idx ].title );
        $( this ).fadeIn();
    });</pre>
<p>The flash is fired&#8230;</p>
<pre class="brush:javascript">    $flash.show().fadeOut( 1000 );</pre>
<p>The pointer has to move over the current thumbnail. The jScrollPane API is used to automatically scroll the bar as the pointer is off the screen, but not if the user hovers over the bar.</p>
<pre class="brush:javascript">    var pointerPosition = $thumbnails.find( 'li' ).eq( idx ).position().left;

    $pointer.animate({
        left: pointerPosition
    }, 500, 'easeInOutBack' );

    if ( ( pointerPosition &gt; $thumbnails.width()
        || pointerPosition &lt; jScrollPaneApi.getContentPositionX() )
        &amp;&amp; !$thumbnails.is( ':hover' ) ) {
            jScrollPaneApi.scrollToX( pointerPosition, true );
    }

    $pointer.click( function() {
        $thumbnails.find( 'a' ).eq( idx ).click()
    });</pre>
<p>Let&#8217;s see what we have to do with our volume button. The idea is to mute or unmute some sounds as the button is clicked. We change the class of the button and set the muting or playing of the sounds accordingly.</p>
<pre class="brush:javascript">$volume.click( function() {
    if ( $( this ).hasClass( 'all' ) ) {
        cameraSounds.unmute();
        trafficSound.mute();

        $( this ).removeClass( 'all' ).addClass( 'some' );
    } else if ( $( this ).hasClass( 'some' ) ) {
        cameraSounds.mute();
        trafficSound.mute();

        $( this ).removeClass( 'some' ).addClass( 'none' );
    } else {
        cameraSounds.unmute();
        trafficSound.unmute();

        $( this ).removeClass( 'none' ).addClass( 'all' );
    }
    return false;
});</pre>
<p>Our gallery is almost set. Now we want that clicking a thumbnail displays a new slide and pauses the slideshow. Its cursor is set to the current number of the clicked thumbnail. That way the slideshow will restart at the right position. All the elements of the page are hidden and we display a &#8220;paused&#8221; message.</p>
<p>Another sound is played.</p>
<pre class="brush:javascript">$thumbnails.find( 'a' ).click( function() {
    $pause.show();
    $pointer.hide();

    $volume.animate( { top: '20px' });
    $thumbnails.animate( { top: '-90px' });
    $title.animate( { bottom: '-90px' });    

    var idx = $( this ).parent( 'li' ).index();
    $.vegas( 'slideshow', { step: idx } )( 'pause' );

    rewindSound.play();

    return false;
});</pre>
<p>A click on the &#8220;paused&#8221; word restarts the slideshow and the thumbnails and title are shown again.</p>
<pre class="brush:javascript">$pause.click( function() {
    $pause.hide();
    $pointer.show();

    $volume.animate( { top:'100px' });
    $title.animate( { bottom:'0px' });
    $thumbnails.animate( { top:'0px' });

    $.vegas( 'slideshow' );

    clickSound.play();

    return false;
});</pre>
<p>That’s it! We hope you enjoyed the tutorial of mashing up some plugins and like the noisy result!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FullscreenSlideshowAudio/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/FullscreenSlideshowAudio/FullscreenSlideshowAudio.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/07/05/fullscreen-slideshow-with-html5-audio/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>Restaurant Website and Gallery Template</title>
		<link>http://tympanus.net/codrops/2011/04/21/restaurant-template/</link>
		<comments>http://tympanus.net/codrops/2011/04/21/restaurant-template/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 09:26:42 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[restaurant]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=4670</guid>
		<description><![CDATA[View demoDownload source Today we want to share a little website experiment with you. The theme for today&#8217;s template is a restaurant website which will include an image gallery for the menu and an integrated Google map that shows the location. The great food photography is by avlxyz and you can find his Flickr photostream [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://tympanus.net/Development/RestaurantTemplate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/RestaurantTemplate.jpg" alt="" title="RestaurantTemplate" width="580" height="315" class="aligncenter size-full wp-image-4682" /></a><br />
<a class="demo" href="http://tympanus.net/Development/RestaurantTemplate/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Development/RestaurantTemplate/RestaurantTemplate.zip">Download source</a></p>
<p>Today we want to share a little website experiment with you. The theme for today&#8217;s template is a restaurant website which will include an image gallery for the menu and an integrated Google map that shows the location.</p>
<p>The great food photography is by <a target="_blank" href="http://www.flickr.com/people/avlxyz/">avlxyz</a> and you can find his Flickr photostream <a target="_blank" href="http://www.flickr.com/photos/avlxyz/">here</a>.<br />
The license for these pictures is the <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Attribution-NonCommercial-ShareAlike 2.0 Generic</a> License.</p>
<p>The main homepage photo of Venice at night is by <a target="_blank" href="http://www.flickr.com/people/krossbow/">krossbow</a>, be sure to check out <a target="_blank" href="http://www.flickr.com/photos/krossbow/">his Flickr photostream</a>.</p>
<p>When coming to the homepage, the background image will fade in and we will see the first welcome content block:</p>
<p><a target="_blank" href="http://tympanus.net/Development/RestaurantTemplate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/restaurantTemplate1.jpg" alt="" title="restaurantTemplate1" width="580" height="299" class="aligncenter size-full wp-image-4673" /></a></p>
<p>When the user clicks on &#8220;Our Menu&#8221;, a little thumbnails gallery will appear in the content area:</p>
<p><a target="_blank" href="http://tympanus.net/Development/RestaurantTemplate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/restaurantTemplate2.jpg" alt="" title="restaurantTemplate2" width="580" height="300" class="aligncenter size-full wp-image-4674" /></a></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<p>Choosing a dish from the thumbnails gallery, will open the fullscreen gallery, that shows the dish image with a title and a description and the same image as background. <strong>Using the navigation arrows on screen, the left/right keyboard arrows, or the scrolling wheel of the mouse, the user can slide the images</strong>. The title and description will animate back behind the foreground image during the sliding.</p>
<p><a target="_blank" href="http://tympanus.net/Development/RestaurantTemplate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/restaurantTemplate3.jpg" alt="" title="restaurantTemplate3" width="580" height="298" class="aligncenter size-full wp-image-4675" /></a></p>
<p>When clicking on the foreground image, it will disappear and the background will become more bright. Now, the user can view the fullscreen image and navigate through them the same way. Clicking on the background will bring us back the foreground gallery element.</p>
<p><a href="http://tympanus.net/Development/RestaurantTemplate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/restaurantTemplate4.jpg" alt="" title="restaurantTemplate4" width="580" height="299" class="aligncenter size-full wp-image-4676" /></a></p>
<p>When we click on the cross on the top right corner, we will leave the image gallery.</p>
<p>The menu point &#8220;Visit us&#8221; will hide the content box and show a google map as the background of the whole page:<br />
<a target="_blank" href="http://tympanus.net/Development/RestaurantTemplate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/restaurantTemplate5.jpg" alt="" title="restaurantTemplate5" width="580" height="299" class="aligncenter size-full wp-image-4677" /></a></p>
<p>And that&#8217;s it! We really hope you liked this template idea and find it useful! </p>
<p><a class="demo" href="http://tympanus.net/Development/RestaurantTemplate/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Development/RestaurantTemplate/RestaurantTemplate.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/04/21/restaurant-template/feed/</wfw:commentRss>
		<slash:comments>170</slash:comments>
		</item>
		<item>
		<title>Fullscreen Gallery with Thumbnail Flip</title>
		<link>http://tympanus.net/codrops/2011/02/09/fullscreen-gallery-with-thumbnail-flip/</link>
		<comments>http://tympanus.net/codrops/2011/02/09/fullscreen-gallery-with-thumbnail-flip/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 13:21:34 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[flip]]></category>
		<category><![CDATA[full screen]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=4132</guid>
		<description><![CDATA[View demoDownload source In this tutorial we will create a fullscreen gallery with jQuery. The idea is to have a thumbnail of the currently shown fullscreen image on the side that flips when navigating through the images. The big image will slide up or down depending where we are navigating to. We will add navigation [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://tympanus.net/Tutorials/FullscreenGalleryThumbnailFlip/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/fullscreenThumbnailFlip.jpg" alt="" title="fullscreenThumbnailFlip" width="580" height="315" class="aligncenter size-full wp-image-4135" /><br />
</a><br />
<a class="demo" href="http://tympanus.net/Tutorials/FullscreenGalleryThumbnailFlip/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/FullscreenGalleryThumbnailFlip/FullscreenGalleryThumbnailFlip.zip">Download source</a></p>
<p>In this tutorial we will create a fullscreen gallery with jQuery. The idea is to have a thumbnail of the currently shown fullscreen image on the side that flips when navigating through the images. The big image will slide up or down depending where we are navigating to. We will add navigation controls for the mousewheel and for keys. The thumbnail will have a zoom and and a fullscreen option, making the image in the background appear in fullscreen mode or as a complete image, resized to fit in the page.</p>
<p>We will be using <a href="http://lab.smashup.it/flip/" target="_blank">Flip!</a>, a jQuery plugin by Lucca Manno that flips elements.</p>
<p>And we will also be using the <a href="http://brandonaaron.net/code/mousewheel/docs" target="_blank">jQuery Mousewheel Plugin</a> by Brandon Aaron.</p>
<p>The beautiful images are by talented Polina Efremova. Visit <a href="http://taigasound.net/" target="_blank">her website</a> and check out <a href="http://www.behance.net/taigasound" target="_blank">her profile on Behance</a>.</p>
<p>Let&#8217;s get started with the markup!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>First, we will add a loading element that we want to show when the images are being loaded:</p>
<pre class="brush:xml">
&lt;div id="tf_loading" class="tf_loading"&gt;&lt;/div&gt;
</pre>
<p>Then, we will create a container for all the images that will be shown in fullscreen:</p>
<pre class="brush:xml">
&lt;div id="tf_bg" class="tf_bg"&gt;
	&lt;img src="images/1.jpg" alt="Image 1" longdesc="images/thumbs/1.jpg" /&gt;
	&lt;img src="images/2.jpg" alt="Image 2" longdesc="images/thumbs/2.jpg"/&gt;
	&lt;img src="images/3.jpg" alt="Image 3" longdesc="images/thumbs/3.jpg"/&gt;
	&lt;img src="images/4.jpg" alt="Image 4" longdesc="images/thumbs/4.jpg"/&gt;
	&lt;img src="images/5.jpg" alt="Image 5" longdesc="images/thumbs/5.jpg"/&gt;
	&lt;img src="images/6.jpg" alt="Image 6" longdesc="images/thumbs/6.jpg"/&gt;
	&lt;div class="tf_pattern"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>We will use the &#8220;longdesc&#8221; attribute to indicate the path to the respective thumbnail. The last div element will server as the overlay pattern.</p>
<p>Next, we will add a container for the contents that are shown on the left bottom corner of the screen. </p>
<pre class="brush:xml">
&lt;div id="tf_content_wrapper" class="tf_content_wrapper"&gt;
	&lt;div class="tf_content" id="content1" style="display:block;"&gt;
		&lt;h2&gt;Dreamer&lt;/h2&gt;
		&lt;p&gt;Far far away, behind the word mountains, ... &lt;/p&gt;
	&lt;/div&gt;
	&lt;div class="tf_content" id="content2"&gt;
		...
	&lt;/div&gt;
	...
&lt;/div&gt;
</pre>
<p>Each box with a heading will be inside of an element with the class &#8220;tf_content&#8221;.</p>
<p>The structure for the thumbnail image on the right side of the screen we look as follows:</p>
<pre class="brush:xml">
&lt;div id="tf_thumbs" class="tf_thumbs"&gt;
	&lt;span id="tf_zoom" class="tf_zoom"&gt;&lt;/span&gt;
	&lt;img src="images/thumbs/1.jpg" alt="Thumb1"/&gt;
&lt;/div&gt;
</pre>
<p>The span will either have the class &#8220;tf_zoom&#8221; or &#8220;tf_fullscreen&#8221; depending on in which mode we are in.</p>
<p>And finally, we will add some elements for the navigation:</p>
<pre class="brush:xml">
&lt;div id="tf_next" class="tf_next"&gt;&lt;/div&gt;
&lt;div id="tf_prev" class="tf_prev"&gt;&lt;/div&gt;
</pre>
<p>Let&#8217;s take a look at the style.</p>
<h3>The CSS</h3>
<p>After doing a simple reset to the body and html, we will define the style for the full images container:</p>
<pre class="brush:css">
.tf_bg{
	width:100%;
	height:100%;
	position:fixed;
	top:0px;
	left:0px;
}
</pre>
<p>The container will be fixed and occupy the whole screen. The images inside will be of absolute positioning and the real width and height will be calculated dynamically in our jQuery function:</p>
<pre class="brush:css">
.tf_bg img{
	position:absolute;
	top:0px;
	left:0px;
	width:100%;
	z-index: 1;
	display:none;
}
</pre>
<p>The pattern will as well be absolute and have a repeated background image:</p>
<pre class="brush:css">
.tf_pattern{
	position:absolute;
	width:100%;
	height:100%;
	background:transparent url(../images/pattern.png) repeat top left;
	z-index:2;
}
</pre>
<p>We will position the content absolutely, too:</p>
<pre class="brush:css">
.tf_content{
	position:absolute;
	bottom:50px;
	left:50px;
	z-index:10;
	display:none;
}
</pre>
<p>The heading of the content will have a different font, that we will embed using the Google Font API. We&#8217;ll come back to that later.</p>
<pre class="brush:css">
.tf_content h2{
	color:#fff;
	font-size:90px;
	padding:0;
	margin:0;
	font-family: 'Dancing Script', arial, serif;
	text-shadow:1px 1px 2px #000;
}
</pre>
<p>The paragraph of the content will have a repeated image as background and some nice box- and text-shadow:</p>
<pre class="brush:css">
.tf_content p{
	color:#fff;
	padding:0;
	margin:0;
	background:transparent url(../images/bg_content.png) repeat top left;
	padding:40px;
	width:500px;
	font-family: 'PT Sans Narrow', arial, serif;
	font-size:20px;
	line-height:25px;
	text-transform:uppercase;
	text-shadow:2px 2px 1px #000;
	-moz-box-shadow:1px 1px 5px #202020;
	-webkit-box-shadow:1px 1px 5px #202020;
	box-shadow:1px 1px 5px #202020;
	border:4px solid #fff;
}
</pre>
<p>The thumbnail container will be positioned in the middle of the screen on the right side. We accomplish that with setting the top to 50% and the top margin to negative half of its height. We will give the container a reflection, that can be seen in Webkit browsers:</p>
<pre class="brush:css">
.tf_thumbs{
	position:absolute;
	z-index:12;
	right:50px;
	top:50%;
	margin-top:-79px;
	border:4px solid #fff;
	-moz-box-shadow:1px 1px 5px #202020;
	-webkit-box-shadow:1px 1px 5px #202020;
	box-shadow:1px 1px 5px #202020;
	-webkit-box-reflect:
		below 5px
		-webkit-gradient(
			linear,
			left top,
			left bottom,
			from(transparent),
			color-stop(0.6, transparent),
			to(rgb(18, 18, 18))
		);
}
.tf_thumbs img{
	display:block;
}
</pre>
<p>The navigation elements will be placed next to the thumbnail container:</p>
<pre class="brush:css">
.tf_next,
.tf_prev{
	width:35px;
	height:14px;
	position:absolute;
	top:50%;
	right:320px;
	z-index:100;
	cursor:pointer;
	background:transparent url(../images/nav.png) no-repeat top left;
	opacity:0.5;
}
.tf_next{
	background-position:0px -14px;
	margin-top:80px;
}
.tf_prev{
	background-position:0px 0px;
	margin-top:-55px;
}
.tf_next:hover,
.tf_prev:hover{
	opacity:0.9;
}
</pre>
<p>The little icons for zoom and fullscreen mode will appear at the right top corner of the thumbnail:</p>
<pre class="brush:css">
.tf_zoom,
.tf_fullscreen{
	width:20px;
	height:20px;
	position:absolute;
	top:6px;
	right:6px;
	cursor:pointer;
	z-index:100;
	opacity:0.6;
	background:transparent url(../images/icons.png) no-repeat top left;
}
.tf_zoom{
	background-position:0px -20px;
}
.tf_fullscreen{
	background-position:0px 0px;
}
.tf_zoom:hover,
.tf_fullscreen:hover{
	opacity:0.9;
}
</pre>
<p>The loading element will be positioned in the center of the screen:</p>
<pre class="brush:css">
.tf_loading{
	position:fixed;
	top:50%;
	left:50%;
	margin:-30px 0px 0px -30px;
	width:60px;
	height:60px;
	background:#fff url(../images/loader.gif) no-repeat center center;
	z-index:999;
	opacity:0.7;
}
</pre>
<p>And that was all the style. Let&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>First, we will include the following scripts:</p>
<pre class="brush:xml">
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery.flip.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery-mousewheel-3.0.4/jquery.mousewheel.min.js"&gt;&lt;/script&gt;
</pre>
<p>Then, we will add the preload function for the images:</p>
<pre class="brush:js">
(function($) {
	$.fn.preload = function(options) {
		var opts 	= $.extend({}, $.fn.preload.defaults, options);
		o			= $.meta ? $.extend({}, opts, this.data()) : opts;
		var c		= this.length,
			l		= 0;
		return this.each(function() {
			var $i	= $(this);
			$('&lt;img/&gt;').load(function(i){
				++l;
				if(l == c) o.onComplete();
			}).attr('src',$i.attr('src'));
		});
	};
	$.fn.preload.defaults = {
		onComplete	: function(){return false;}
	};
})(jQuery);
</pre>
<p>In our jQuery function, we will first cache some element and define some variables:</p>
<pre class="brush:js">
var $tf_bg				= $('#tf_bg'),
	$tf_bg_images		= $tf_bg.find('img'),
	$tf_bg_img			= $tf_bg_images.eq(0),
	$tf_thumbs			= $('#tf_thumbs'),
	total				= $tf_bg_images.length,
	current				= 0,
	$tf_content_wrapper	= $('#tf_content_wrapper'),
	$tf_next			= $('#tf_next'),
	$tf_prev			= $('#tf_prev'),
	$tf_loading			= $('#tf_loading');
</pre>
<p>Then, we will preload the images:</p>
<pre class="brush:js">
$tf_bg_images.preload({
	onComplete	: function(){
		$tf_loading.hide();
		init();
	}
});
</pre>
<p>The next function will show the first image and initialize some events:</p>
<pre class="brush:js">
function init(){
	//get dimentions for the image, based on the windows size
	var dim	= getImageDim($tf_bg_img);
	//set the returned values and show the image
	$tf_bg_img.css({
		width	: dim.width,
		height	: dim.height,
		left	: dim.left,
		top		: dim.top
	}).fadeIn();

	//resizing the window resizes the $tf_bg_img
	$(window).bind('resize',function(){
		var dim	= getImageDim($tf_bg_img);
		$tf_bg_img.css({
			width	: dim.width,
			height	: dim.height,
			left	: dim.left,
			top		: dim.top
		});
	});

	//expand and fit the image to the screen
	$('#tf_zoom').live('click',
	function(){
		if($tf_bg_img.is(':animated'))
			return false;

		var $this	= $(this);
		if($this.hasClass('tf_zoom')){
			resize($tf_bg_img);
			$this.addClass('tf_fullscreen')
			.removeClass('tf_zoom');
		}
		else{
			var dim	= getImageDim($tf_bg_img);
			$tf_bg_img.animate({
				width	: dim.width,
				height	: dim.height,
				top		: dim.top,
				left	: dim.left
			},350);
			$this.addClass('tf_zoom')
			.removeClass('tf_fullscreen');
		}
	}
	);

	//click the arrow down, scrolls down
	$tf_next.bind('click',function(){
		if($tf_bg_img.is(':animated'))
			return false;
		scroll('tb');
	});

	//click the arrow up, scrolls up
	$tf_prev.bind('click',function(){
		if($tf_bg_img.is(':animated'))
			return false;
		scroll('bt');
	});

	//mousewheel events - down / up button trigger the scroll down / up
	$(document).mousewheel(function(e, delta) {
		if($tf_bg_img.is(':animated'))
			return false;

		if(delta > 0)
			scroll('bt');
		else
			scroll('tb');
		return false;
	});

	//key events - down / up button trigger the scroll down / up
	$(document).keydown(function(e){
		if($tf_bg_img.is(':animated'))
			return false;

		switch(e.which){
			case 38:
				scroll('bt');
				break;	

			case 40:
				scroll('tb');
				break;
		}
	});
}
</pre>
<p>The next function takes care of showing the next or previous image:</p>
<pre class="brush:js">
function scroll(dir){
	//if dir is "tb" (top -> bottom) increment current,
	//else if "bt" decrement it
	current	= (dir == 'tb')?current + 1:current - 1;

	//we want a circular slideshow,
	//so we need to check the limits of current
	if(current == total) current = 0;
	else if(current < 0) current = total - 1;

	//flip the thumb
	$tf_thumbs.flip({
		direction	: dir,
		speed		: 400,
		onBefore	: function(){
			//the new thumb is set here
			var content	= '<span id="tf_zoom" class="tf_zoom"></span>';
			content		+='&lt;img src="' + $tf_bg_images.eq(current).attr('longdesc') + '" alt="Thumb' + (current+1) + '"/&gt;';
			$tf_thumbs.html(content);
		}
	});

	//we get the next image
	var $tf_bg_img_next	= $tf_bg_images.eq(current),
	//its dimentions
	dim				= getImageDim($tf_bg_img_next),
	//the top should be one that makes the image out of the viewport
	//the image should be positioned up or down depending on the direction
	top	= (dir == 'tb')?$(window).height() + 'px':-parseFloat(dim.height,10) + 'px';

	//set the returned values and show the next image
	$tf_bg_img_next.css({
		width	: dim.width,
		height	: dim.height,
		left	: dim.left,
		top		: top
	}).show();

	//now slide it to the viewport
	$tf_bg_img_next.stop().animate({
		top 	: dim.top
	},1000);

	//we want the old image to slide in the same direction, out of the viewport
	var slideTo	= (dir == 'tb')?-$tf_bg_img.height() + 'px':$(window).height() + 'px';
	$tf_bg_img.stop().animate({
		top 	: slideTo
	},1000,function(){
		//hide it
		$(this).hide();
		//the $tf_bg_img is now the shown image
		$tf_bg_img	= $tf_bg_img_next;
		//show the description for the new image
		$tf_content_wrapper.children()
		.eq(current)
		.show();
	});
	//hide the current description
	$tf_content_wrapper.children(':visible')
	.hide()

}
</pre>
<p>The resize function will animate the image to a screen fitting size:</p>
<pre class="brush:js">
function resize($img){
	var w_w	= $(window).width(),
	w_h	= $(window).height(),
	i_w	= $img.width(),
	i_h	= $img.height(),
	r_i	= i_h / i_w,
	new_w,new_h;

	if(i_w &gt; i_h){
		new_w	= w_w;
		new_h	= w_w * r_i;

		if(new_h &gt; w_h){
			new_h	= w_h;
			new_w	= w_h / r_i;
		}
	}
	else{
		new_h	= w_w * r_i;
		new_w	= w_w;
	}

	$img.animate({
		width	: new_w + 'px',
		height	: new_h + 'px',
		top		: '0px',
		left	: '0px'
	},350);
}
</pre>
<p>The last function will give us the dimensions of an image and its correct positioning:</p>
<pre class="brush:js">
function getImageDim($img){
	var w_w	= $(window).width(),
	w_h	= $(window).height(),
	r_w	= w_h / w_w,
	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 &gt; r_i){
		new_h	= w_h;
		new_w	= w_h / r_i;
	}
	else{
		new_h	= w_w * r_i;
		new_w	= w_w;
	}

	return {
		width	: new_w + 'px',
		height	: new_h + 'px',
		left	: (w_w - new_w) / 2 + 'px',
		top		: (w_h - new_h) / 2 + 'px'
	};
}
</pre>
<p>And that was all the jQuery. Now, we want to embed some fonts. For that we will include the following references in the head of our HTML:</p>
<pre class="brush:xml">
&lt;link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css' /&gt;
&lt;link href='http://fonts.googleapis.com/css?family=Dancing+Script' rel='stylesheet' type='text/css' /&gt;
</pre>
<p>And that&#8217;s all! We hope you enjoyed the tutorial and learning something new today! </p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FullscreenGalleryThumbnailFlip/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/FullscreenGalleryThumbnailFlip/FullscreenGalleryThumbnailFlip.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/02/09/fullscreen-gallery-with-thumbnail-flip/feed/</wfw:commentRss>
		<slash:comments>97</slash:comments>
		</item>
		<item>
		<title>3D Wall Gallery</title>
		<link>http://tympanus.net/codrops/2011/02/02/3d-wall-gallery/</link>
		<comments>http://tympanus.net/codrops/2011/02/02/3d-wall-gallery/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 12:41:37 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[perspective]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[thumbnails]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=4047</guid>
		<description><![CDATA[View demoDownload source Today we want to share our latest experiment with you: the 3D Wall Gallery. Using the Safari browser the images of this gallery will be put into 3D perspective, when scrolling or sliding. When viewed with another browser, the gallery will be shown normally, retaining all the functionality. For seeing the 3D [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/3DWallGallery/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/3dwallgallery.jpg" alt="" title="3dwallgallery" width="580" height="315" class="aligncenter size-full wp-image-4060" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/3DWallGallery/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Development/3DWallGallery/3DWallGallery.zip">Download source</a></p>
<p>Today we want to share our latest experiment with you: the 3D Wall Gallery. Using the Safari browser the images of this gallery will be put into 3D perspective, when scrolling or sliding. When viewed with another browser, the gallery will be shown normally, retaining all the functionality.</p>
<p><strong>For seeing the 3D effect, please try the demo in Safari.</strong></p>
<p>Summarized, you can do the following things in this gallery:</p>
<ul>
<li>Hover an image to see a description</li>
<li>Slide through the images using the jQuery UI Slider at the top</li>
<li>Use the mouse wheel to scroll through the images</li>
<li>Use the thumbnail previewer at the bottom to choose an image</li>
<li>Use the hash anchor for the image in the URL to get to it directly</li>
<li>Click on an image to slide it to the left (notice the hash anchor in the URL)</li>
<li><strong>Turn it into a 3D wall when scrolling/sliding (Safari users)</strong></li>
<li><strong>Flipping the perspective when changing the slide/scroll direction (Safari users)</strong></li>
</ul>
<p>We are using the jQuery hash change plugin by Ben Alman:<br />
<a href="http://benalman.com/projects/jquery-hashchange-plugin/" target="_blank">jQuery Hashchange Plugin</a></p>
<p>And we are also using the jQuery Mousewheel Plugin by Brandon Aaron:<br />
<a href="http://brandonaaron.net/code/mousewheel/docs" target="_blank">jQuery Mousewheel Plugin</a></p>
<p>The beautiful photography is by Alan Antiporda from Illusive Photography and you can find his Flickr Photostream here: <a target="_blank" href="http://www.flickr.com/photos/alanant">Illusive Photography Photostream</a></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/3dwall_image0.jpg" alt="" title="3dwall_image0" width="580" height="304" class="nofancy aligncenter size-full wp-image-4048" /><br />
When viewed in the Safari browser, you will see the perspective happening while scrolling or sliding. When changing the direction of scrolling, you will notice that the perspective will tilt to the other side.</p>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/3dwall_image1.jpg" alt="" title="3dwall_image1" width="580" height="304" class="nofancy aligncenter size-full wp-image-4049" /><br />
You can navigate through the images by either using the jQuery UI slider at the top or your mousewheel. </p>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/3dwall_image2.jpg" alt="" title="3dwall_image2" width="580" height="304" class="nofancy aligncenter size-full wp-image-4050" /><br />
You can also use the thumbnails previewer to click on an image and get to it directly.</p>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/3dwall_image3.jpg" alt="" title="3dwall_image3" width="580" height="304" class="nofancy aligncenter size-full wp-image-4051" /><br />
When hovering over an image you can see a little description at the top.</p>
<p>We hope that you enjoy our little experiment and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Development/3DWallGallery/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Development/3DWallGallery/3DWallGallery.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/02/02/3d-wall-gallery/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/tag/gallery/feed/ ) in 0.30049 seconds, on May 23rd, 2012 at 2:20 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 23rd, 2012 at 3:20 pm UTC -->
