<?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; zoom out</title>
	<atom:link href="http://tympanus.net/codrops/tag/zoom-out/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>Photo Zoom Out Effect with jQuery</title>
		<link>http://tympanus.net/codrops/2010/03/07/photo-zoom-out-effect-with-jquery/</link>
		<comments>http://tympanus.net/codrops/2010/03/07/photo-zoom-out-effect-with-jquery/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 15:46:51 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[zoom out]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1641</guid>
		<description><![CDATA[View demoDownload source Today we will show you how to create a simple image zoom out effect with jQuery. The idea is show some images which are zoomed in initially and when hovering over an image it gets zoomed out. This effect could be used in photography websites or image galleries. Our example uses some [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/" target="_blank"><img class="aligncenter size-full wp-image-1647" title="photozoom" src="http://tympanus.net/codrops/wp-content/uploads/2010/03/photozoom.png" alt="photozoom" width="580" height="250" /></a></p>
<p><a class="demo" href="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/PhotoZoomOutEffect.zip">Download source</a></p>
<p>Today we will show you how to create a simple image zoom out effect with jQuery. The idea is show some images which are zoomed in initially and when hovering over an image it gets zoomed out. This effect could be used in photography websites or image galleries. Our example uses some black and white images to focus on the effect.</p>
<p>Ok, let&#8217;s get started.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We will create some wrappers for the images which will be divs. These wrappers will hide any overflow, because we don&#8217;t want the picture (which will be much bigger) to show completely. Inside we will have a link element that surrounds the image:</p>
<pre class="brush:xml">&lt;div class="wrap"&gt;
	&lt;a href="http://www.flickr.com/photos/archetypefotografie/3601313864/"&gt;
		&lt;img src="images/image1.jpg" alt="Picture 1"/&gt;
	&lt;/a&gt;
&lt;/div&gt;
&lt;div class="wrap"&gt;
	&lt;a href="http://www.flickr.com/photos/vegaseddie/3910559910/"&gt;
		&lt;img src="images/image2.jpg" alt="Picture 2"/&gt;
	&lt;/a&gt;
&lt;/div&gt;
&lt;div class="wrap"&gt;
	&lt;a href="http://www.flickr.com/photos/62337512@N00/445175934/"&gt;
		&lt;img src="images/image3.jpg" alt="Picture 3"/&gt;
	&lt;/a&gt;
&lt;/div&gt;
&lt;div class="wrap"&gt;
	&lt;a href="http://www.flickr.com/photos/brunociampi/2461177417/"&gt;
		&lt;img src="images/image4.jpg" alt="Picture 4"/&gt;
	&lt;/a&gt;
&lt;/div&gt;
&lt;div class="wrap"&gt;
	&lt;a href="http://www.flickr.com/photos/beadmobile/3298460491/"&gt;
		&lt;img src="images/image5.jpg" alt="Picture 5"/&gt;
	&lt;/a&gt;
&lt;/div&gt;
&lt;div class="wrap"&gt;
	&lt;a href="http://www.flickr.com/photos/tonythemisfit/3839281139/"&gt;
		&lt;img src="images/image6.jpg" alt="Picture 6"/&gt;
	&lt;/a&gt;
&lt;/div&gt;</pre>
<p>All images have the same size (500px times 333px) because we want the effect to be the same on each image. You can use images of a different size, but keep in mind that you need to adapt the JavaScript function in order to achieve a smooth effect.</p>
<h3>The CSS</h3>
<p>The wrapper for the link and the image will float left and have relative positioning. The image will have absolute positioning and we will define the top and left in a way that it centers the image:</p>
<pre class="brush:css">.wrap{
    width:200px;
    height:200px;
    margin:0px;
    overflow:hidden;
    position:relative;
    float:left;
}
.wrap a img{
    border:none;
    position:absolute;
    top:-66.5px;
    left:-150px;
    height:500px;
    opacity: 0.5;
}</pre>
<p>As mentioned before, the image has a height of 333px. We want the image to be &#8220;zoomed in&#8221; initially so we set the size bigger. In this case we chose to set it to a height of 500px. When setting the size of just one side, the image will resize accordingly and you don&#8217;t have to worry about the other value.</p>
<p>With the JavaScript function we will then zoom the image out.</p>
<h3>The JavaScript</h3>
<p>The function for hovering over the images will be pretty straightforward: we make the image opaque, change the height to 200px and set the top and left to zero. When moving the mouse out we will set the style back to the initial one:</p>
<pre class="brush:js">$(function() {
	$('#container img').hover(
		function(){
			var $this = $(this);
			$this.stop().animate({
					'opacity':'1.0',
					'height':'200px',
					'top':'0px',
					'left':'0px'
				});
		},
		function(){
			var $this = $(this);
			$this.stop().animate({
				'opacity':'0.5',
				'height':'500px',
				'top':'-66.5px',
				'left':'-150px'
				});
		}
	);
});</pre>
<p>And that&#8217;s it!<br />
Enjoy!</p>
<p><a class="demo" href="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/PhotoZoomOutEffect.zip">Download source</a></p>
<p><!-- wp_ad_camp_1 --></p>
<div class="partner_section_post"><span>Message from Testking</span>Get professional <a href="http://www.pass4sure.com/CCIE.html">ccie training</a> to learn about jQuery plugins.  Sign up for <a href="http://www.pass4sure.com/CCENT.html">ccent course</a> to prepare and pass your <a href="http://www.pass4sure.com/Exin-ITIL.html">itil v3 certification</a> on time.</div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/03/07/photo-zoom-out-effect-with-jquery/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/tag/zoom-out/feed/ ) in 0.20199 seconds, on May 24th, 2012 at 12:59 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 24th, 2012 at 1:59 am UTC -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for (  tympanus.net/codrops/tag/zoom-out/feed/ ) in 0.53888 seconds, on May 24th, 2012 at 1:41 am UTC. -->
