<?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; thumbnail</title>
	<atom:link href="http://tympanus.net/codrops/tag/thumbnail/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Mon, 06 Feb 2012 07:30:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Original Hover Effects with CSS3</title>
		<link>http://tympanus.net/codrops/2011/11/02/original-hover-effects-with-css3/</link>
		<comments>http://tympanus.net/codrops/2011/11/02/original-hover-effects-with-css3/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 16:19:16 +0000</pubDate>
		<dc:creator>Alessio Atzeni</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6228</guid>
		<description><![CDATA[The power of CSS3 is enormous and in this tutorial we will see how to exploit it in a very creative way. We are going to create some thumbnail hover effects with CSS3 transitions. On hover over a thumbnail, we will reveal some description of the thumbnail, using a different style in each example.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffects.jpg" alt="OriginalHoverEffects" width="580" height="315" class="aligncenter size-full wp-image-6249" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/OriginalHoverEffects/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/OriginalHoverEffects/OriginalHoverEffects.zip">Download source</a></p>
<p>The power of CSS3 is enormous and in this tutorial we will see how to exploit it in a very creative way. We are going to create some thumbnail hover effects with CSS3 transitions. On hover over a thumbnail, we will reveal some description of the thumbnail, using a different style in each example.</p>
<p><strong>Please note that this will only work properly in modern browsers that support the CSS3 properties in use.</strong></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>The structure of markup is very simple and intuitive. Create a container that will have our image and all the other infomation.</p>
<p>Inside the <strong>view</strong> insert an element with the class <strong>mask</strong> that will be responsible for our effects driven by CSS3 and inside it we will put a title, description and a link to the full image. (For some examples, we&#8217;ll need to add the mask element as a separate element and wrap the description in a devi with class <strong>content</strong>.)</p>
<pre class="brush:xml">
&lt;div class="view"&gt;
     &lt;img src="image.gif" /&gt;
     &lt;div class="mask"&gt;
     &lt;h2&gt;Title&lt;/h2&gt;
     &lt;p&gt;Your Text&lt;/p&gt;
         &lt;a href="#" class="info"&gt;Read More&lt;/a&gt;
     &lt;/div&gt;
&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<p>After creating our markup we&#8217;re going to set our style.<br />
We set the general rules for our class and then we are going to add a special class with the desired effect styles. We will omit the CSS3 vendor prefixes when showing the style.</p>
<pre class="brush:css">
.view {
    width: 300px;
    height: 200px;
    margin: 10px;
    float: left;
    border: 10px solid #fff;
    overflow: hidden;
    position: relative;
    text-align: center;
    box-shadow: 1px 1px 2px #e6e6e6;
    cursor: default;
    background: #fff url(../images/bgimg.jpg) no-repeat center center
}
.view .mask, .view .content {
    width: 300px;
    height: 200px;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0
}
.view img {
    display: block;
    position: relative
}
.view h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    margin: 20px 0 0 0
}
.view p {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 12px;
    position: relative;
    color: #fff;
    padding: 10px 20px 20px;
    text-align: center
}
.view a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 0 1px #000
}
.view a.info:hover {
    box-shadow: 0 0 5px #000
}
</pre>
<p>And now we&#8217;ll look at the ten effects.</p>
<h4>Example 1</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect01.jpg" alt="OriginalHoverEffect01" width="580" height="205" class="aligncenter size-full wp-image-6237" /></a></p>
<p>Add the special class <strong>view-first</strong> to the element with the class <strong>view</strong> for this effect. <em>We will be adding a special class to each example&#8217;s view element (view-first, view-second, view-third, etc.).</em></p>
<pre class="brush:xml">
&lt;div class="view view-first"&gt;
     <!-- ... -->
&lt;/div&gt;
</pre>
<p>In this first example we will just use some basic transitions to create a nice hover effect. </p>
<pre class="brush:css">
.view-first img {
    transition: all 0.2s linear;
}
.view-first .mask {
    opacity: 0;
    background-color: rgba(219,127,8, 0.7);
    transition: all 0.4s ease-in-out;
}
.view-first h2 {
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.2s ease-in-out;
}
.view-first p {
    transform: translateY(100px);
    opacity: 0;
	transition: all 0.2s linear;
}
.view-first a.info{
    opacity: 0;
	transition: all 0.2s ease-in-out;
}
</pre>
<p>And now comes the heart of our effect. When you move the mouse over the image, we can use the delay property to emulate simple animations. The transition-delay that we use in the hover class can be altered, to be differnt than the one in the normal class. In this example we did not use any delay in the normal class; but we added a delay on hover, which will make the transition start a bit later. Moving the mouse out, the default value of 0s will apply and the &#8220;reverse&#8221; will be quicker. </p>
<pre class="brush:css">
.view-first:hover img {
	transform: scale(1.1);
}
.view-first:hover .mask {
	opacity: 1;
}
.view-first:hover h2,
.view-first:hover p,
.view-first:hover a.info {
    opacity: 1;
    transform: translateY(0px);
}
.view-first:hover p {
    transition-delay: 0.1s;
}
.view-first:hover a.info {
    transition-delay: 0.2s;
}
</pre>
<h4>Example 2</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index2.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect02.jpg" alt="OriginalHoverEffect02" width="580" height="202" class="aligncenter size-full wp-image-6238" /></a></p>
<p>In this second example we will add the special class <strong>view-second</strong>, but we will leave the element with the class <strong>mask</strong> empty and wrap the description in a div with the class <strong>content</strong></p>
<pre class="brush:xml">
&lt;div class="view view-second"&gt;
	&lt;img src="images/5.jpg" /&gt;
	&lt;div class="mask"&gt;&lt;/div&gt;
	&lt;div class="content"&gt;
		&lt;h2&gt;Hover Style #2&lt;/h2&gt;
		&lt;p&gt;Some description&lt;/p&gt;
		&lt;a href="#" class="info"&gt;Read More&lt;/a&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Here the mask class will have different attributes to satisfy our effect, in fact we are going to apply the transform property (translate and rotate) and will make a square out of it. The description elements will be translated, i.e. moved so that we can slide them in on hover:</p>
<pre class="brush:css">
.view-second img {
	transition: all 0.2s ease-in;
}
.view-second .mask {
	background-color: rgba(115,146,184, 0.7);
	width: 300px;
    padding: 60px;
	height: 300px;
	opacity: 0;
	transform: translate(265px, 145px) rotate(45deg);
	transition: all 0.2s ease-in-out;
}
.view-second h2 {
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    background: transparent;
    margin: 20px 40px 0px 40px;
    transform: translate(200px, -200px);
	transition: all 0.2s ease-in-out;
}
.view-second p {
	transform: translate(-200px, 200px);
	transition: all 0.2s ease-in-out;
}
.view-second a.info {
    transform: translate(0px, 100px);
	transition: all 0.2s 0.1s ease-in-out;
}
</pre>
<p>For our hover effect we exploit the translate transformation in order to move our elements in place. The mask will also be rotated. The elements of the description will each come with a little delay:</p>
<pre class="brush:css">
.view-second:hover .mask {
	opacity:1;
	transform: translate(-80px, -125px) rotate(45deg);
}
.view-second:hover h2 {
	transform: translate(0px,0px);
	transition-delay: 0.3s;
}
.view-second:hover p {
    transform: translate(0px,0px);
	transition-delay: 0.4s;
}
.view-second:hover a.info {
	transform: translate(0px,0px);
	transition-delay: 0.5s;
}
</pre>
<h4>Example 3</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index3.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect03.jpg" alt="OriginalHoverEffect03" width="580" height="198" class="aligncenter size-full wp-image-6239" /></a></p>
<p>In this third example we will use the translate and rotate transforms to bring up our content:</p>
<pre class="brush:css">
.view-third img {
    transition: all 0.2s ease-in;
}
.view-third .mask {
	background-color: rgba(0,0,0,0.6);
	opacity: 0;
	transform: translate(460px, -100px) rotate(180deg);
	transition: all 0.2s 0.4s ease-in-out;
}
.view-third h2{
	transform: translateY(-100px);
	transition: all 0.2s ease-in-out;
}
.view-third p {
	transform: translateX(300px) rotate(90deg);
	transition: all 0.2s ease-in-out;
}
.view-third a.info {
	transform: translateY(-200px);
	transition: all 0.2s ease-in-out;
}
</pre>
<p>These are the simple instructions that are applied on hover. Now we will reverse the appearing of the description elements by setting the transition-delay accordingly:</p>
<pre class="brush:css">
.view-third:hover .mask {
	opacity:1;
	transition-delay: 0s;
	transform: translate(0px, 0px);
}
.view-third:hover h2 {
	transform: translateY(0px);
	transition-delay: 0.5s;
}
.view-third:hover p	{
    transform: translateX(0px) rotate(0deg);
	transition-delay: 0.4s;
}
.view-third:hover a.info {
	transform: translateY(0px);
	transition-delay: 0.3s;
}
</pre>
<h4>Example 4</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index4.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect04.jpg" alt="OriginalHoverEffect04" width="580" height="199" class="aligncenter size-full wp-image-6240" /></a></p>
<p>Here in the fourth example we will perform a simple zoom out image and a zoom in of our content with rotation, all thanks to the <strong>scale</strong> transform. We set the transition-delay to 0.2s for the image style, but on hover we&#8217;ll say that it&#8217;s 0s. This will make it start immediately on hover, but delay it on mouse out.</p>
<pre class="brush:css">
.view-fourth img {
	transition: all 0.4s ease-in-out 0.2s;
    opacity: 1;
}
.view-fourth .mask {
	background-color: rgba(0,0,0,0.8);
	opacity: 0;
	transform: scale(0) rotate(-180deg);
	transition: all 0.4s ease-in;
    border-radius: 0px;
}
.view-fourth h2{
    opacity: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    background: transparent;
    margin: 20px 40px 0px 40px;
	transition: all 0.5s ease-in-out;
}
.view-fourth p {
	opacity: 0;
	transition: all 0.5s ease-in-out;
}
.view-fourth a.info {
    opacity: 0;
	transition: all 0.5s ease-in-out;
}
</pre>
<p>These are the simple instructions to get the effect &#8211; with CSS3 you can do everything :) </p>
<pre class="brush:css">
.view-fourth:hover .mask {
	opacity: 1;
	transform: scale(1) rotate(0deg);
	transition-delay: 0.2s;
}
.view-fourth:hover img 	  {
	transform: scale(0);
    opacity: 0;
	transition-delay: 0s;
}
.view-fourth:hover h2,
.view-fourth:hover p,
.view-fourth:hover a.info{
    opacity: 1;
    transition-delay: 0.5s;
}
</pre>
<h4>Example 5</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index5.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect05.jpg" alt="" title="OriginalHoverEffect05" width="580" height="204" class="aligncenter size-full wp-image-6241" /></a></p>
<p>In this fifth example we will use the translate property along with the transition-timing-function <strong>ease-in-out</strong> in order to slide the content in from the left.</p>
<pre class="brush:css">
.view-fifth img {
	transition: all 0.3s ease-in-out;
}
.view-fifth .mask {
	background-color: rgba(146,96,91,0.3);
	transform: translateX(-300px);
	opacity: 1;
	transition: all 0.4s ease-in-out;
}
.view-fifth h2{
    background: rgba(255, 255, 255, 0.5);
    color: #000;
    box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5);
}
.view-fifth p{
    opacity: 0;
    color: #333;
    transition: all 0.2s linear;
}
</pre>
<p>The hover effect will make the image slide to the right and the description come from the left, as if it&#8217;s pushing the image:</p>
<pre class="brush:css">
.view-fifth:hover .mask {
	transform: translateX(0px);
}
.view-fifth:hover img {
	transform: translateX(300px);
	transition-delay: 0.1s;
}
.view-fifth:hover p{
    opacity: 1;
    transition-delay: 0.4s;
}
</pre>
<h4>Example 6</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index6.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect06.jpg" alt="OriginalHoverEffect06" width="580" height="207" class="aligncenter size-full wp-image-6242" /></a></p>
<p>In this example we will make the description come from the front, zooming out until its original size (scale from factor 10 to 1).  The info button will slide in from the bottom (translate). </p>
<pre class="brush:css">
.view-sixth img {
	transition: all 0.4s ease-in-out 0.5s;
}
.view-sixth .mask{
	background-color: rgba(146,96,91,0.5);
	opacity:0;
	transition: all 0.3s ease-in 0.4s;
}
.view-sixth h2{
	opacity:0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    background: transparent;
    margin: 20px 40px 0px 40px;
    transform: scale(10);
    transition: all 0.3s ease-in-out 0.1s;
}
.view-sixth p {
	opacity:0;
    transform: scale(10);
	transition: all 0.3s ease-in-out 0.2s;
}
.view-sixth a.info {
	opacity:0;
    transform: translateY(100px);
	transition: all 0.3s ease-in-out 0.1s;
}
</pre>
<p>The reverse transition will be delayed in such a way that it looks smooth:</p>
<pre class="brush:css">
.view-sixth:hover .mask {
	opacity:1;
	transition-delay: 0s;
}
.view-sixth:hover img {
	transition-delay: 0s;
}
.view-sixth:hover h2 {
	opacity: 1;
    transform: scale(1);
	transition-delay: 0.1s;
}
.view-sixth:hover p {
	opacity:1;
    transform: scale(1);
	transition-delay: 0.2s;
}
.view-sixth:hover a.info {
	opacity:1;
    transform: translateY(0px);
	transition-delay: 0.3s;
}
</pre>
<h4>Example 7</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index7.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect07.jpg" alt="OriginalHoverEffect07" width="580" height="199" class="aligncenter size-full wp-image-6243" /></a></p>
<p>In this seventh example the idea is to rotate the image to the center and scale it down. Then the description comes rotating from up with the description content following.</p>
<pre class="brush:css">
.view-seventh img{
    transition: all 0.5s ease-out;
	opacity: 1;
}
.view-seventh .mask {
	background-color: rgba(77,44,35,0.5);
    transform: rotate(0deg) scale(1);
	opacity: 0;
	transition: all 0.3s ease-out;
    transform: translateY(-200px) rotate(180deg);
}
.view-seventh h2{
    transform: translateY(-200px);
	transition: all 0.2s ease-in-out;
}
.view-seventh p {
    transform: translateY(-200px);
	transition: all 0.2s ease-in-out;
}
.view-seventh a.info {
    transform: translateY(-200px);
	transition:  all 0.2s ease-in-out;
}
</pre>
<p>On hover we add a delay for the desciption elements. This will show us the rotating image first and then the description will come into the picture. In the reverse transition, everything will disappear immediately and we&#8217;ll see the image rotate back:</p>
<pre class="brush:css">
.view-seventh:hover img{
    transform: rotate(720deg) scale(0);
	opacity: 0;
}
.view-seventh:hover .mask {
	opacity: 1;
    transform: translateY(0px) rotate(0deg);
    transition-delay: 0.4s;
}
.view-seventh:hover h2 {
    transform: translateY(0px);
	transition-delay: 0.7s;
}
.view-seventh:hover p {
	transform: translateY(0px);
	transition-delay: 0.6s;
}
.view-seventh:hover a.info {
    transform: translateY(0px);
	transition-delay: 0.5s;
}
</pre>
<h4>Example 8</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index8.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect08.jpg" alt="OriginalHoverEffect08" width="580" height="198" class="aligncenter size-full wp-image-6244" /></a></p>
<p>In this eighth example we&#8217;ll use an animation and recreate a bounce effect. The description will bounce in from the top. </p>
<pre class="brush:css">
.view-eighth .mask {
	background-color: rgba(255, 255, 255, 0.7);
	top: -200px;
	opacity: 0;
	transition: all 0.3s ease-out 0.5s;
}
.view-eighth h2{
    transform: translateY(-200px);
	transition: all 0.2s ease-in-out 0.1s;
}
.view-eighth p {
    color: #333;
    transform: translateY(-200px);
	transition: all 0.2s ease-in-out 0.2s;
}
.view-eighth a.info {
    transform: translateY(-200px);
	transition:  all 0.2s ease-in-out 0.3s;
}
</pre>
<p>We&#8217;ll add the animation to the mask element and define some fitting delays for the onset of the description elements:</p>
<pre class="brush:css">
.view-eighth:hover .mask {
	opacity: 1;
	top: 0px;
	transition-delay: 0s;
    animation: bounceY 0.9s linear;
}
.view-eighth:hover h2 {
    transform: translateY(0px);
	transition-delay: 0.4s;
}
.view-eighth:hover p {
	transform: translateY(0px);
	transition-delay: 0.2s;
}
.view-eighth:hover a.info {
    transform: translateY(0px);
	transition-delay: 0s;
}
</pre>
<p>To recreate a true bounce effect we use the <strong>translateY</strong>, as you can see there are a couple of frames, in order to make the effect:</p>
<pre class="brush:css">
@keyframes bounceY {
    0% { transform: translateY(-205px);}
    40% { transform: translateY(-100px);}
    65% { transform: translateY(-52px);}
    82% { transform: translateY(-25px);}
    92% { transform: translateY(-12px);}
    55%, 75%, 87%, 97%, 100% { transform: translateY(0px);}
}
</pre>
<h4>Example 9</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index9.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect09.jpg" alt="OriginalHoverEffect09" width="580" height="203" class="aligncenter size-full wp-image-6245" /></a></p>
<p>In this example, we will use two mask elements to slide them in from the bottom right and the top left:</p>
<pre class="brush:xml">
&lt;div class="view view-ninth"&gt;
	&lt;img src="images/11.jpg" /&gt;
	&lt;div class="mask mask-1"&gt;&lt;/div&gt;
	&lt;div class="mask mask-2"&gt;&lt;/div&gt;
	&lt;div class="content"&gt;
		&lt;h2&gt;Hover Style #9&lt;/h2&gt;
		&lt;p&gt;Some Text&lt;/p&gt;
		&lt;a href="#" class="info"&gt;Read More&lt;/a&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The two masks will have a different translation and a transfrom origin. Also, we&#8217;ll set one to be aligned at the top and the other at the bottom: </p>
<pre class="brush:css">
.view-ninth .mask-1,
.view-ninth .mask-2{
	background-color: rgba(0,0,0,0.5);
    height: 361px;
    width: 361px;
	background: rgba(119,0,36,0.5);
	opacity: 1;
    transition: all 0.3s ease-in-out 0.6s;
}
.view-ninth .mask-1 {
    left: auto;
    right: 0px;
    transform: rotate(56.5deg) translateX(-180px);
    transform-origin: 100% 0%;
}
.view-ninth .mask-2 {
    top: auto;
    bottom: 0px;
    transform: rotate(56.5deg) translateX(180px);
    transform-origin: 0% 100%;
}
</pre>
<p>The content will be styled in a way that it looks like as if it&#8217;s coming out as a tiny slice through the touching edges of the two masks:</p>
<pre class="brush:css">
.view-ninth .content{
    background: rgba(0,0,0,0.9);
    height: 0px;
    opacity: 0.5;
    width: 361px;
    overflow: hidden;
    transform: rotate(-33.5deg) translate(-112px,166px);
    transform-origin: 0% 100%;
    transition: all 0.4s ease-in-out 0.3s;
}
.view-ninth h2{
    background: transparent;
    margin-top: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.view-ninth a.info{
    display: none;
}
</pre>
<p>On hover, we&#8217;ll make the content come out from the slot and make the masks touch at their edges:</p>
<pre class="brush:css">
.view-ninth:hover .content{
    height: 120px;
    width: 300px;
    opacity: 0.9;
    top: 40px;
    transform: rotate(0deg) translate(0px,0px);
}
.view-ninth:hover .mask-1,
.view-ninth:hover .mask-2{
	transition-delay: 0s;
}
.view-ninth:hover .mask-1{
    transform: rotate(56.5deg) translateX(1px);
}
.view-ninth:hover .mask-2 {
    transform: rotate(56.5deg) translateX(-1px);
}
</pre>
<p>We are setting the transition-delay for the masks in such a way, that when we hover, the transition happens instantly. But when moving out with the mouse, the delay will be longer, as if its &#8220;waiting&#8221; for the content to move back into the slot.</p>
<h4>Example 10</h4>
<p><a href="http://tympanus.net/Tutorials/OriginalHoverEffects/index10.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/OriginalHoverEffect10.jpg" alt="OriginalHoverEffect10" width="580" height="201" class="aligncenter size-full wp-image-6246" /></a></p>
<p>In the last example, we will zoom in the image and make it fade out while bringing the descpription to the front. We can do that by using the scale transform and setting the opacity level:</p>
<pre class="brush:css">
.view-tenth img {
	transform: scaleY(1);
	transition: all 0.7s ease-in-out;
}
.view-tenth .mask {
    background-color: rgba(255, 231, 179, 0.3);
    transition: all 0.5s linear;
    opacity: 0;
}
.view-tenth h2{
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    background: transparent;
    margin: 20px 40px 0px 40px;
    transform: scale(0);
    color: #333;
    transition: all 0.5s linear;
    opacity: 0;
}
.view-tenth p {
    color: #333;
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s linear;
}
.view-tenth a.info {
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s linear;
}
</pre>
<p>On hover, we&#8217;ll simply scale the image up and fade it out by decreasing its opacity to 0:</p>
<pre class="brush:css">
.view-tenth:hover img {
	transform: scale(10);
    opacity: 0;
}
.view-tenth:hover .mask {
	opacity: 1;
}
.view-tenth:hover h2,
.view-tenth:hover p,
.view-tenth:hover a.info{
    transform: scale(1);
    opacity: 1;
}
</pre>
<h3>Conclusion</h3>
<p>CSS3 has a really great potential for creating nice effects. Soon, we&#8217;ll hopefully be able to avoid the use of JavaScript for simple effects and rely 100% on CSS, in all browsers.<br />
I hope that you liked these experiments, but above all I hope that they can inspire you for your projects.</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/OriginalHoverEffects/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/OriginalHoverEffects/OriginalHoverEffects.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/11/02/original-hover-effects-with-css3/feed/</wfw:commentRss>
		<slash:comments>102</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>Fresh Sliding Thumbnails Gallery with jQuery and PHP</title>
		<link>http://tympanus.net/codrops/2010/05/23/fresh-sliding-thumbnails-gallery-with-jquery-php/</link>
		<comments>http://tympanus.net/codrops/2010/05/23/fresh-sliding-thumbnails-gallery-with-jquery-php/#comments</comments>
		<pubDate>Sun, 23 May 2010 21:55:52 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animate]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[scrolling]]></category>
		<category><![CDATA[slide out]]></category>
		<category><![CDATA[sliding]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2147</guid>
		<description><![CDATA[View demoDownload source In this tutorial we are going to create another full page image gallery with a nice thumbnail area that scrolls automatically when moving the mouse. The idea is to allow the user to slightly zoom into the picture by clicking on it. The thumbnails bar slides down and the image resizes according [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGallery/" target="_blank"><img class="aligncenter size-full wp-image-2254" title="freshslidingthumbnaislgallery" src="http://tympanus.net/codrops/wp-content/uploads/2010/05/freshslidingthumbnaislgallery1.jpg" alt="" width="580" height="315" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGallery/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGallery/FreshSlidingThumbnailsGallery.zip">Download source</a></p>
<p>In this tutorial we are going to create another full page image gallery with a nice thumbnail area that scrolls automatically when moving the mouse. The idea is to allow the user to slightly zoom into the picture by clicking on it. The thumbnails bar slides down and the image resizes according to the screen size.</p>
<p>The scrolling functionality of the thumbnails bar is based on the great tutorial by Andrew Valums: <a href="http://valums.com/scroll-menu-jquery/" target="_blank">Horizontal Scrolling Menu made with CSS and jQuery</a>.<br />
Additionally, we will be using PHP to get the images and thumbs automatically from the folder structure. The folders will contain album sub-folders and we will add a select option to the gallery which allows to choose an album.</p>
<p>Just like in the <a href="http://tympanus.net/codrops/2010/05/14/sliding-panel-photo-wall-gallery-with-jquery/" target="_blank">Sliding Panel Photo Wall Gallery with jQuery</a> we will be using a resize function for the image displayed.</p>
<p>We will also add an XML file that (optionally) contains the descriptions of the images.</p>
<p>Another neat functionality that we are going to add is the changing cursor: depending in which mode and in which position of the full image we are, the cursor will change to a left or right arrow (for browsing the pictures), or to a plus or minus sign (for zooming in or out).</p>
<p>The beautiful images in the demo are from the <a href="http://www.flickr.com/photos/2dogs_productions/sets/72157594522520053/">Models 1 &#8211; Photoshoots</a> album from Vincent Boiteau&#8217;s photostream on Flickr.</p>
<p><strong>We also have a static version of the image gallery without the album option. You can find the demo link and the ZIP file in the <a href="#theendofpost">end of this post</a></strong>.</p>
<p>And don&#8217;t forget to check out the tutorial of the  mobile version of this gallery: <a href="../2010/05/27/awesome-mobile-image-gallery-web-app/" target="_blank">Awesome Mobile Image Gallery Web App</a></p>
<p>So, let&#8217;s start!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Folder Structure</h3>
<p>Today we will start this tutorial by the folder structure since it is important for our PHP functionality.</p>
<p>The necessary folders for the PHP to work are the images folder and the thumbs folder. They both need to be located in the root folder (where you will have the index.php file).</p>
<p>Whatever album sub-folder will be in the thumbs folder, also needs to be in the images folder. So, if we have <strong>thumbs/album1/22.jpg</strong> we also need <strong>images/album1/22.jpg</strong> which will be the full-size image.</p>
<p style="text-align: center;"><img class="nofancy size-full wp-image-2155  aligncenter" title="folderstructure" src="http://tympanus.net/codrops/wp-content/uploads/2010/05/folderstructure.jpg" alt="" width="489" height="257" /></p>
<p>With that organization we will be able to automatically display the album thumbnails and create a select box for all albums.</p>
<p>In each album folder of the thumbs we will also have an XML file with the descriptions for the images. We will call that file <strong>desc.xml</strong>. Adding the description for images is not obligatory, i.e. we will just read the ones that are there. The structure of the XML file will be the following:</p>
<pre class="brush:xml">&lt;descriptions&gt;
	&lt;image&gt;
		&lt;name&gt;1.jpg&lt;/name&gt;
		&lt;text&gt;This is a nice description&lt;/text&gt;
	&lt;/image&gt;
	&lt;image&gt;
		&lt;name&gt;2.jpg&lt;/name&gt;
		&lt;text&gt;red!&lt;/text&gt;
	&lt;/image&gt;
	&lt;image&gt;
		&lt;name&gt;3.jpg&lt;/name&gt;
		&lt;text&gt;another one...&lt;/text&gt;
	&lt;/image&gt;
	...
&lt;/descriptions&gt;
</pre>
<p>It is important that we name the images in the name tag correctly.<br />
And also, make sure not to have any other files lying around in those folders.</p>
<h3>The Markup and PHP</h3>
<p>Let&#8217;s take a look at the HTML and also the PHP. We have a simple structure that will be dynamically &#8220;filled&#8221; by our PHP and JavaScript code:</p>
<pre class="brush:xml">&lt;div class="albumbar"&gt;
	&lt;span&gt;Vincent Boiteau's photostream&lt;/span&gt;
	&lt;div id="albumSelect" class="albumSelect"&gt;
		&lt;ul&gt;
			&lt;!-- We will dynamically generate the items --&gt;
			&lt;?php
				$firstAlbum = '';
				$i=0;
				if(file_exists('images')) {
					$files = array_slice(scandir('images'), 2);
					if(count($files)) {
						natcasesort($files);
						foreach($files as $file) {
							if($file != '.' &amp;&amp; $file != '..') {
								if($i===0)
									$firstAlbum = $file;
								else
									echo "&lt;li&gt;&lt;a&gt;$file&lt;/a&gt;&lt;/li&gt;";
								++$i;
							}
						}
					}
				}
			?&gt;
		&lt;/ul&gt;
		&lt;div class="title down"&gt;
			&lt;?php echo $firstAlbum;?&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;div id="loading"&gt;&lt;/div&gt;
&lt;div id="preview"&gt;
	&lt;div id="imageWrapper"&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;div id="thumbsWrapper"&gt;
&lt;/div&gt;
&lt;div class="infobar"&gt;
	&lt;span id="description"&gt;&lt;/span&gt;
&lt;/div&gt;
</pre>
<p>The select box items get generated dynamically: we check the sub-folders in the images folder and put all the names in our items. The first album will be &#8220;selected&#8221; by default.</p>
<p style="text-align: center;"><img class="nofancy size-full wp-image-2168  aligncenter" title="FreshSlidingThumbnailsGallery_select" src="http://tympanus.net/codrops/wp-content/uploads/2010/05/FreshSlidingThumbnailsGallery_select.png" alt="" width="424" height="254" /></p>
<p>When we click on one of the items we will call the thumbs.php (inside the ajax folder) from within the JavaScript. We will get back an array (JSON) with all the information that we need to build our thumbnails. Let&#8217;s look at that PHP code first and later we will go through the JS:</p>
<pre class="brush:php">$album 		= $_GET['album'];
$imagesArr	= array();
$i		= 0;

/* read the descriptions xml file */
if(file_exists('../thumbs/'.$album.'/desc.xml')) {
    $xml = simplexml_load_file('../thumbs/'.$album.'/desc.xml');
}
/* read the images from the album and get the
 * description from the XML file:
 */
if(file_exists('../thumbs/'.$album)) {
    $files = array_slice(scandir('../thumbs/'.$album), 2);
    if(count($files)) {
        foreach($files as $file) {
            if($file != '.' &amp;&amp; $file != '..' &amp;&amp;  $file!='desc.xml') {
                if($xml) {
                    $desc = $xml-&gt;xpath('image[name="'.$file.'"]/text');
                    $description = $desc[0];
                    if($description=='')
                        $description = '';
                }
                $imagesArr[] = array('src' =&gt; 'thumbs/'.$album.'/'.$file,
                    'alt'	=&gt; 'images/'.$album.'/'.$file,
                    'desc'	=&gt; $description);
            }
        }
    }
}
$json 		= $imagesArr;
$encoded 	= json_encode($json);
echo $encoded;
unset($encoded);
</pre>
<p>So, we basically get all the thumbnails of the requested album and prepare the information for each img element. The final element that we will then add to our HTML will contain an alt attribute with the full image location as value and a title attribute with the description of the regarding picture as value. The description of the image is taken from the XML file we mentioned before. With an xpath expression we get to the node &#8220;name&#8221; that contains the image name and then we get the text of the description. In the JS we will then say that the description should be the value of the &#8220;title&#8221; attribute.</p>
<p>Now, let&#8217;s take a look at the style.</p>
<h3>The CSS</h3>
<p>First, we will add some default styling to the body:</p>
<pre class="brush:css">body{
    font-family:Verdana;
    text-transform:uppercase;
    color:#fff;
    font-size:10px;
    overflow:hidden;
    background-color:#f9f9f9;
}
</pre>
<p>The current background color will be almost white but you can try other colors, it looks really wonderful with some!</p>
<p>Let&#8217;s style the album bar for the title of the page:</p>
<pre class="brush:css">.albumbar{
    height:24px;
    line-height:24px;
    text-align:center;
    position:fixed;
    background-color:#000;
    left:0px;
    width:100%;
    top:0px;
    -moz-box-shadow:-2px 0px 4px #333;
    -webkit-box-shadow:-2px 0px 4px #333;
    box-shadow:-2px 0px 4px #333;
    z-index:11;
}
</pre>
<p>And also the info bar which will contain the description of each image:</p>
<pre class="brush:css">.infobar{
    height:22px;
    line-height:22px;
    text-align:center;
    position:fixed;
    background-color:#000;
    left:0px;
    width:100%;
    bottom:0px;
    -moz-box-shadow:0px -1px 2px #000;
    -webkit-box-shadow:0px -1px 2px #000;
    box-shadow:0px -1px 2px #000;
}
span#description, .albumbar span{
    text-shadow:0px 0px 1px #fff;
    color:#fff;
}
.albumbar span a{
    color:#aaa;
    text-decoration:none;
}
.albumbar span a:hover{
    color:#ddd;
}
</pre>
<p>The info bar and the album bar will be fixed and located at the top and bottom of the page.<br />
The select box and the inner list will be styled as follows:</p>
<pre class="brush:css">.albumSelect{
    height:18px;
    line-height:18px;
    position:absolute;
    right:5px;
    top:2px;
    width:120px;
}
.albumSelect .title{
    color:#f0f0f0;
    z-index:10;
    border:1px solid #444;
    background-color:#555;
    background-repeat:no-repeat;
    background-position:90% 50%;
    cursor:pointer;
    text-align:left;
    text-indent:10px;
    width:100%;
    position:absolute;
    top:0px;
    left:0px;
}
</pre>
<p>The title div will have a little triangle as background image. We define two classes, up and down, that we will then set dynamically depending on if the album list is expanded or not:</p>
<pre class="brush:css">.down{
    background-image:url(../icons/down.png);
}
.up{
    background-image:url(../icons/up.png);
}
</pre>
<p>The unordered list with all the albums will be styled as follows:</p>
<pre class="brush:css">.albumSelect ul {
    list-style:none;
    display:none;
    padding:0px;
    width:100%;
    border:1px solid #444;
    background-color:#555;
    margin:22px 0px 0px 0px;
    -moz-box-shadow:0px 0px 2px #000;
    -webkit-box-shadow:0px 0px 2px #000;
    box-shadow:0px 0px 2px #000;
}
.albumSelect ul li a{
    text-decoration:none;
    cursor:pointer;
    display:block;
    padding:3px 0px;
    color:#ccc;
}
.albumSelect ul li a:hover{
    background-color:#000;
    color:#fff;
}
</pre>
<p>The list is set to display:none in the beginning since we only want it to appear when the user clicks on the triangle to expand it.</p>
<p>The loading container will be set to appear at the center of the page, with just a little bit more to the top since we have the thumbnails bar appearing sometimes. Setting top to 40% gives us what we need:</p>
<pre class="brush:css">#loading{
    display:none;
    width:50px;
    height:50px;
    position:absolute;
    top:40%;
    left:50%;
    margin-left:-24px;
    background:transparent url(../icons/loading.gif) no-repeat top left;
}
</pre>
<p>To make the thumbs bar scrollable by moving the mouse we need to give it a special style. The thumbsWrapper will be positioned absolutely and occupy the width of the window. We set the vertical overflow to hidden because we don&#8217;t want any scroll bar to appear on the right.<br />
The horizontal overflow will be managed in the JavaScript (it will be hidden).</p>
<pre class="brush:css">#thumbsWrapper{
    position: absolute;
    width:100%;
    height:102px;
    overflow-y:hidden;
    background-color:#000;
    bottom:0px;
    left:0px;
    border-top:2px solid #000;
}
</pre>
<p>The thumbsContainer will be the inner div that will have a width equal to the sum of all the thumbnail widths. We will calculate the width dynamically in the JavaScript, so we don&#8217;t define it in the class:</p>
<pre class="brush:css">#thumbsContainer{
    height:79px;
    display:block;
    margin: 0;
}
</pre>
<p>The thumbnail images will have the following style:</p>
<pre class="brush:css">#thumbsWrapper img{
    float:left;
    margin:2px;
    display:block;
    cursor:pointer;
    opacity:0.4;
    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);
}
</pre>
<p>We give them a low opacity value since we want to add a hover effect.</p>
<p>The imageWrapper that contains the full image has the following style:</p>
<pre class="brush:css">#imageWrapper{
    position:relative;
    text-align:center;
    padding-top:30px;
}
</pre>
<p>We add a top padding because we have the album bar at the top of the page. We don&#8217;t want the image to get hidden by it. The margin 0 auto will center the image horizontally:</p>
<pre class="brush:css">#imageWrapper img{
    margin:0 auto;
    -moz-box-shadow:2px 2px 10px #111;
    -webkit-box-shadow:2px 2px 10px #111;
    box-shadow:2px 2px 10px #111;
}
</pre>
<p>We also create a neat box shadow for all modern browsers :)<br />
Some of you might wonder why we set text-align center in the imageWrapper if we have the margin in the image. When we make things appear with the fadeIn function in jQuery, the display of the respective element becomes &#8220;block&#8221;. For that case our &#8220;margin:0 auto&#8221; will center the image. But for the case when we put the first image initially we need the inline centering property which is to give the parent &#8220;text-align:center&#8221;.</p>
<p>And finally, we define the classes for the different cursor types:</p>
<pre class="brush:css">.cursorRight{
.cursorRight{
    cursor:url("../icons/next.cur"), url("icons/next.cur"), default;
}
.cursorLeft{
    cursor:url("../icons/prev.cur"), url("icons/prev.cur"),  default;
}
.cursorPlus{
    cursor:url("../icons/plus.cur"), url("icons/plus.cur"), default;
}
.cursorMinus{
    cursor:url("../icons/minus.cur"), url("icons/minus.cur"), default;
}
</pre>
<p>OK, this is basically a hack and not really nice, but the reason for this ugliness is the browsers&#8217; handling. The first url is the path for FireFox, the second one is for IE and the default value needs to be there again for Firefox. Read more about custom cursors and cross-browser compatibility <a href="http://beradrian.wordpress.com/2008/01/08/cross-browser-custom-css-cursors/" target="_blank">here</a>.</p>
<p>Now, let&#8217;s get to the JavaScript.</p>
<h3>The JavaScript</h3>
<p>Let&#8217;s go step by step through the jQuery code. I will not follow the order like it is in the script but by the usage of the functions. I hope that it will be easier to understand like that.<br />
In our <code>$(function() { }</code> we will add the following JavaScript:</p>
<pre class="brush:js">/* name of the selected album, in the top right combo box */
    var album	= $('#albumSelect div').html();
    /* mode is small or expanded, depending on the picture size  */
    var mode = 'small';
    /* this is the index of the last clicked picture */
    var current = 0;
</pre>
<p>So, we will first declare some variables that we will need later and then we call:</p>
<pre class="brush:js"> buildThumbs();
</pre>
<p>The buildThumbs() function is going to get the current album and generate the images with the accoring source and information:</p>
<pre class="brush:js">function buildThumbs(){
	current=1;
	$('#imageWrapper').empty();
	$('#loading').show();
	$.get('ajax/thumbs.php?album='+album, function(data) {
		var countImages = data.length;
		var count = 0;
		var $tContainer = $('&lt;div/&gt;',{
			id	: 'thumbsContainer',
			style	: 'visibility:hidden;'
		})
		for(var i = 0; i &lt; countImages; ++i){
			try{
				var description = data[i].desc[0];
			}catch(e){
				description='';
			}
			if(description==undefined)
				description='';
			$('&lt;img title="'+description+'" alt="'+data[i].alt+'" height="75" /&gt;').load(function(){
				var $this = $(this);
				$tContainer.append($this);
				++count;
				if(count==1){
					/* load 1 image into container*/
					$('&lt;img id="displayed" style="display:block;" class="cursorPlus"/&gt;').load(function(){
						var $first = $(this);
						$('#loading').hide();
						resize($first,0);
						$('#imageWrapper').append($first);
						$('#description').html($this.attr('title'));
					}).attr('src',$this.attr('alt'));
				}
				if(count == countImages){
					$('#thumbsWrapper').empty().append($tContainer);
					thumbsDim($tContainer);
					makeScrollable($('#thumbsWrapper'),$tContainer,15);
				}
			}).attr('src',data[i].src);
		}
	},'json');
}
</pre>
<p>As we mentioned before, we will be using the thumbs.php file to get the info we need. When we are done building all the thumb images we append it to the thumbsWrapper and determine the size of the container with <code>thumbsDim</code> (line 36):</p>
<pre class="brush:js">/* adjust the size (width) of the scrollable container
- this depends on all its images widths
*/
function thumbsDim($elem){
	var finalW = 0;
	$elem.find('img').each(function(i){
		var $img 		= $(this);
		finalW+=$img.width()+5;
	//plus 5 -&gt; 4 margins + 1 to avoid rounded calculations
	});
	$elem.css('width',finalW+'px').css('visibility','visible');
}
</pre>
<p>Then we use <code>makeScrollable</code> (line 37) to make the thumbnail container scrollable by mouse move:</p>
<pre class="brush:js">//Get our elements for faster access and set overlay width
function makeScrollable($wrapper, $container, contPadding){
	//Get menu width
	var divWidth = $wrapper.width();

	//Remove scrollbars
	$wrapper.css({
		overflow: 'hidden'
	});

	//Find last image container
	var lastLi = $container.find('img:last-child');
	$wrapper.scrollLeft(0);
	//When user move mouse over menu
	$wrapper.unbind('mousemove').bind('mousemove',function(e){

		//As images are loaded ul width increases,
		//so we recalculate it each time
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + contPadding;

		var left = (e.pageX - $wrapper.offset().left) * (ulWidth-divWidth) / divWidth;
		$wrapper.scrollLeft(left);
	});
}
</pre>
<p>The following function takes care of the click event on a thumbnail and also the hover event:</p>
<pre class="brush:js">/*
clicking on a thumb loads the image
(alt attribute of the thumb is the source of the large image);
mouseover and mouseout for a nice spotlight hover effect
*/
$('#thumbsContainer img').live('click',function(){
	loadPhoto($(this),'cursorPlus');
}).live('mouseover',function(){
	var $this   = $(this);
	$this.stop().animate({
		'opacity':'1.0'
	},200);
}).live('mouseout',function(){
	var $this   = $(this);
	$this.stop().animate({
		'opacity':'0.4'
	},200);
});
</pre>
<p>When a thumbnail is clicked we call the function <code>loadPhoto</code> (and we also pass the current cursor mode):</p>
<pre class="brush:js">/*
loads a picture into the imageWrapper
the image source is in the thumb's alt attribute
*/
function loadPhoto($thumb,cursorClass){
	current		= $thumb.index()+1;
	$('#imageWrapper').empty();
	$('#loading').show();
	$('&lt;img id="displayed" title="'+$thumb.attr('title')+'" class="'+cursorClass+'" style="display:none;"/&gt;').load(function(){
		var $this = $(this);
		$('#loading').hide();
		resize($this,0);
		if(!$('#imageWrapper').find('img').length){
                  $('#imageWrapper').append($this.fadeIn(1000));
                  $('#description').html($this.attr('title'));
            }
	}).attr('src',$thumb.attr('alt'));
}
</pre>
<p>When want to adapt the size of the picture when we resize the window:</p>
<pre class="brush:js">/* when resizing the window resize the picture */
$(window).bind('resize', function() {
	resize($('#displayed'),0);
});
</pre>
<p>The <code>resize</code> function is defined as follows:</p>
<pre class="brush:js">/* function to resize an image based on the windows width and height */
function resize($image, type){
	var widthMargin     = 10
	var heightMargin    = 0;
	if(mode=='expanded')
		heightMargin = 60;
	else if(mode=='small')
		heightMargin = 150;
	//type 1 is animate, type 0 is normal
	var windowH      = $(window).height()-heightMargin;
	var windowW      = $(window).width()-widthMargin;
	var theImage     = new Image();
	theImage.src     = $image.attr("src");
	var imgwidth     = theImage.width;
	var imgheight    = theImage.height;

	if((imgwidth &gt; windowW)||(imgheight &gt; windowH)){
		if(imgwidth &gt; imgheight){
			var newwidth = windowW;
			var ratio = imgwidth / windowW;
			var newheight = imgheight / ratio;
			theImage.height = newheight;
			theImage.width= newwidth;
			if(newheight&gt;windowH){
				var newnewheight = windowH;
				var newratio = newheight/windowH;
				var newnewwidth =newwidth/newratio;
				theImage.width = newnewwidth;
				theImage.height= newnewheight;
			}
		}
		else{
			var newheight = windowH;
			var ratio = imgheight / windowH;
			var newwidth = imgwidth / ratio;
			theImage.height = newheight;
			theImage.width= newwidth;
			if(newwidth&gt;windowW){
				var newnewwidth = windowW;
				var newratio = newwidth/windowW;
				var newnewheight =newheight/newratio;
				theImage.height = newnewheight;
				theImage.width= newnewwidth;
			}
		}
	}
	if((type==1)&amp;&amp;(!$.browser.msie))
		$image.stop(true).animate({
			'width':theImage.width+'px',
			'height':theImage.height+'px'
			},1000);
	else
		$image.css({
			'width':theImage.width+'px',
			'height':theImage.height+'px'
			});
}
</pre>
<p>The <code>heightMargin</code> depends on the mode we are in: if the thumbnails bar is out, we have less space so we reduce the allowed height of the image.</p>
<p>The following functions take care of what happens when we select an album:</p>
<pre class="brush:js">/* Album combo events to open, close,
and select an album from the combo
*/
$('#albumSelect div').bind('click',function(){
	var $this = $(this);
	if($this.is('.up'))
		closeAlbumCombo();
	else if($this.is('.down'))
		openAlbumCombo();
});
$('#albumSelect ul &gt; li').bind('click',function(){
	var $this 	= $(this);
	album 		= $this.find('a').html();
	buildThumbs();
	var $combo = $('#albumSelect div');
	$this.find('a').html($combo.html());
	$combo.html(album);
	closeAlbumCombo();
	orderCombo($this.parent());
});
</pre>
<p>And these are the three functions taking care of our self made combo box:</p>
<pre class="brush:js">//functions to control the albums combos
function closeAlbumCombo(){
	var $combo = $('#albumSelect div');
	$combo.addClass('down').removeClass('up');
	$combo.prev().hide();
}
function openAlbumCombo(){
	var $combo = $('#albumSelect div');
	$combo.addClass('up').removeClass('down');
	$combo.prev().show();
}
function orderCombo($ul){
	var items = $ul.find('li').get();
	items.sort(function(a,b){
		var keyA = $(a).text();
		var keyB = $(b).text();

		if (keyA &lt; keyB) return -1;
		if (keyA &gt; keyB) return 1;
		return 0;
	});
	$.each(items, function(i, li){
		$ul.append(li);
	});
}
</pre>
<p>Now we define what happens when we hover over the main image or when we click on it. Depending on where we hover over the image, we want a certain cursor to appear. For that we check where we are with the mouse and apply the regarding class to the image:</p>
<pre class="brush:js">/*
when hovering the main image change the mouse icons (left,right,plus,minus)
also when clicking on the image, expand it or make it smaller depending on the mode
*/
$('#displayed').live('mousemove',function(e){
	var $this 	= $(this);
	var imageWidth 	= parseFloat($this.css('width'),10);

	var x = e.pageX - $this.offset().left;
	if(x&lt;(imageWidth/3))
		$this.addClass('cursorLeft')
			 .removeClass('cursorPlus cursorRight cursorMinus');
	else if(x&gt;(2*(imageWidth/3)))
		$this.addClass('cursorRight')
			 .removeClass('cursorPlus cursorLeft cursorMinus');
	else{
		if(mode=='expanded'){
			$this.addClass('cursorMinus')
				 .removeClass('cursorLeft cursorRight cursorPlus');
		}
		else if(mode=='small'){
			$this.addClass('cursorPlus')
				 .removeClass('cursorLeft cursorRight cursorMinus');
		}
	}
}).live('click',function(){
	var $this = $(this);
	if(mode=='expanded' &amp;&amp; $this.is('.cursorMinus')){
		mode='small';
		$this.addClass('cursorPlus')
			 .removeClass('cursorLeft cursorRight cursorMinus');
		$('#thumbsWrapper').stop().animate({
			'bottom':'0px'
		},300);
		resize($this,1);
	}
	else if(mode=='small' &amp;&amp; $this.is('.cursorPlus')){
		mode='expanded';
		$this.addClass('cursorMinus')
			 .removeClass('cursorLeft cursorRight cursorPlus');
		$('#thumbsWrapper').stop().animate({
			'bottom':'-85px'
		},300);
		resize($this,1);
	}
	else if($this.is('.cursorRight')){
		var $thumb = $('#thumbsContainer img:nth-child('+parseInt(current+1)+')');
		if($thumb.length){
			++current;
			loadPhoto($thumb,'cursorRight');
		}
	}
	else if($this.is('.cursorLeft')){
		var $thumb = $('#thumbsContainer img:nth-child('+parseInt(current-1)+')');
		if($thumb.length){
			--current;
			loadPhoto($thumb,'cursorLeft');
		}
	}
});
</pre>
<p>When we click on the image, we check which cursor we had, because like that we know which image we have to display next (i.e. the next or the previous one). Our &#8220;current&#8221; variable helps us keep track of which picture we are currently viewing.</p>
<p>And that&#8217;s it! I hope you enjoyed this gigantic tutorial!</p>
<p>Note that in this demo we don&#8217;t use very big images, so the &#8220;zoom in&#8221;/ resize will just show you the full image maximum and never resize the picture beyond its real dimensions. If you use very large images the effect will be a nice experience for users with a large screen.</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGallery/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGallery/FreshSlidingThumbnailsGallery.zip">Download source</a></p>
<p style="clear: both;">We also have a static version of this photo gallery without the album functionality. Check out the <a href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGalleryStatic/" target="_blank">static demo</a> or <a href="http://tympanus.net/Tutorials/FreshSlidingThumbnailsGalleryStatic/FreshSlidingThumbnailsGalleryStatic.zip">download the ZIP file</a>.</p>
<p>We created a mobile version of this gallery: <a href="http://tympanus.net/codrops/2010/05/27/awesome-mobile-image-gallery-web-app/" target="_blank">Awesome Mobile Image Gallery Web App</a></p>
<p style="text-align: center;"><img class="nofancy size-full wp-image-2251  aligncenter" title="previewMobile" src="http://tympanus.net/codrops/wp-content/uploads/2010/05/previewMobile.jpg" alt="" width="395" height="215" /></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
<div class="partner_section_post"><span>Message from Testking</span>Join our online <a href="http://www.testkingsite.com/comptia/N10-004.html">testking N10-004</a> web designing course to learn  how to improve your website using PHP and jQuery. Download  <a href="http://www.testkingsite.com/microsoft/70-640.html">testking 70-640</a> tutorial and  <a href="http://www.testkingsite.com/comptia/220-701.html">testking 220-701</a> design guide to learn how to create fresh sliding thumbnails gallery with jquery.</div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/05/23/fresh-sliding-thumbnails-gallery-with-jquery-php/feed/</wfw:commentRss>
		<slash:comments>142</slash:comments>
		</item>
		<item>
		<title>Dynamic jQuery Image Gallery with Uploader</title>
		<link>http://tympanus.net/codrops/2009/09/13/dynamic-jquery-image-gallery-with-uploader/</link>
		<comments>http://tympanus.net/codrops/2009/09/13/dynamic-jquery-image-gallery-with-uploader/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 13:30:26 +0000</pubDate>
		<dc:creator>chadking</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=426</guid>
		<description><![CDATA[Here&#8217;s a jQuery Image Gallery script with a multi file Uploader, that was implemented using three resources that I found on the web: uploadify ad-gallery class.upload.php click on the image to see a demo It&#8217;s easy to find a lot of good image galleries out there, a lot of upload scripts and thumbnail generators. But [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a jQuery Image Gallery script with a multi file Uploader, that was implemented using three resources that I found on the web:</p>
<ol>
<li><a href="http://www.uploadify.com/" target="_blank">uploadify</a></li>
<li><a href="http://coffeescripter.com/2009/07/ad-gallery-a-jquery-gallery-plugin/" target="_blank">ad-gallery </a></li>
<li><a href="http://www.verot.net/php_class_upload.htm" target="_blank">class.upload.php</a></li>
</ol>
<p><a href="http://tympanus.net/gallery/" target="_blank"><img class="alignnone size-full wp-image-429" src="http://tympanus.net/codrops/wp-content/uploads/2009/09/gallery.gif" alt="" width="600" height="379" /></a></p>
<p>click on the image to see a demo</p>
<p><span id="more-426"></span><br />
It&#8217;s easy to find a lot of good image galleries out there, a lot of upload scripts and thumbnail generators. But I found it hard to find one script that includes them all, so I decided to try to integrate them in one, which is actually what is interesting to have in a site. I basically put them together and added one or two functions to the whole thing, and added some Ajax script to load the pictures.<br />
So now, besides being able to see the gallery, which is pretty cool by the way, you can upload multiple image files (for this demo just jpg and gif, although you can configure what you want) next to it and have them added to the gallery on the fly, after the upload is finished (you can click on &#8220;last uploads&#8221; in the demo to see the last images). If you don&#8217;t want that the images are loaded immediatly after you upload them, then just remove the onAllComplete option in the innitialization of the uploadify plugin, in index.html.<br />
Because this is a demo I limited the pictures size that you can upload to 500kb, and you can just upload 5 at a time. Of course then you can configure this as you like.<br />
For the thumbs and images generator, I use the class.upload.php script  (very nice work), and I call it in the file uploadify.php. There you can configure the way you want your pictures to be generated, both original and thumbnail (for example the sizes, the filenames, the maximum size, if you want that pictures with the same name are replaced &#8230;). For this script I generate a hash for the name of the files, which will be always different. You can change that if you want&#8230; Remember that the folder where the pictures are stored (images and images/thumbs) should have the right permissions in order for you to upload your files.</p>
<p>I would suggest that you take a look at the possible configurations for each one of the scripts that I used:</p>
<ul>
<li>for the class.upload.php <a href="http://www.verot.net/res/sources/class.upload.html" target="_blank">here </a></li>
<li>for the uploadify <a href="http://www.uploadify.com/documentation/" target="_blank">here</a></li>
<li>for the ad-gallery <a href="http://coffeescripter.com/code/ad-gallery/" target="_blank">here</a></li>
</ul>
<p>see the <a href="http://tympanus.net/gallery/" target="_blank">DEMO</a></p>
<p>download source code <a href="http://tympanus.net/codrops/wp-content/uploads/2009/09/gallery.zip">here</a></p>
<p>You can find more jQuery Image Galleries <a href="http://tympanus.net/codrops/2009/09/07/42-jquery-image-gallery-plugins/" target="_blank">here</a></p>
<p>If you have any suggestions for this script, or if you find some bugs please let me know.</p>
<p><div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div><br />
<br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2009/09/13/dynamic-jquery-image-gallery-with-uploader/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/tag/thumbnail/feed/ ) in 0.28882 seconds, on Feb 8th, 2012 at 5:35 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 6:35 pm UTC -->
