<?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; overlay</title>
	<atom:link href="http://tympanus.net/codrops/tag/overlay/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>Overlay-like Effect with jQuery</title>
		<link>http://tympanus.net/codrops/2011/02/15/overlay-like-effect/</link>
		<comments>http://tympanus.net/codrops/2011/02/15/overlay-like-effect/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 17:35:19 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[opacity]]></category>
		<category><![CDATA[overlay]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=4225</guid>
		<description><![CDATA[View demoDownload source Today we will create a slick overlay effect with jQuery that does not use an overlay. The idea is to change the opacity or the color of certain elements in order to make it look like as if we are covering the content with an overlay. This allows to focus certain elements [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/OverlayLikeEffect/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/02/overlayLikeEffect.jpg" alt="" title="overlayLikeEffect" width="580" height="315" class="aligncenter size-full wp-image-4226" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/OverlayLikeEffect/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/OverlayLikeEffect/OverlayLikeEffect.zip">Download source</a></p>
<p>Today we will create a slick overlay effect with jQuery that does not use an overlay. The idea is to change the opacity or the color of certain elements in order to make it look like as if we are covering the content with an overlay. This allows to focus certain elements in a web page while making others appear less prominent. </p>
<p>First, we need to define which elements we want to apply the effect to, meaning that we either want to animate the element&#8217;s opacity or color, or both. To the elements we want to fade, we will give the class &#8220;e-fade&#8221; and to the elements we want to change the color, we will give the class &#8220;e-color&#8221;. For any of these elements, no matter if we apply one or the other, or both classes, we will need to give the class &#8220;effect&#8221;.</p>
<p>An example for using these classes is the following HTML structure:</p>
<pre class="brush:xml">
&lt;!-- Animates the color --&gt;
&lt;h2 class="effect e-color"&gt;Custom effects with jQuery&lt;/h2&gt;

&lt;!-- Animates the opacity --&gt;
&lt;h2 class="effect e-fade"&gt;Custom effects with jQuery&lt;/h2&gt;

&lt;!-- Animates both color and opacity --&gt;
&lt;h2 class="effect e-color e-fade"&gt;Custom effects with jQuery&lt;/h2&gt;
</pre>
<p>In our example we will use a menu to trigger the animation events.  When we mouse over the menu items, the regarding element&#8217;s effects will get executed. </p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<p>To enhance certain elements, we will have one more class, one that will let us know that these elements should be left untouched by the animations. This will give us the possibility to focus on certain elements.<br />
The class name will be the same like the ID for one of the menu items. That way, we are creating a relation between them:</p>
<pre class="brush:xml">
&lt;ul id="menu" class="menu"&gt;
	&lt;li&gt;&lt;a href="#"&gt;&lt;img src="images/1.png" alt="1"/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;&lt;img src="images/2.png" alt="2"/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;&lt;img src="images/3.png" alt="3"/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;&lt;img src="images/4.png" alt="4"/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#" id="effect-n"&gt;&lt;img src="images/5.png" alt="5"/&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

...

&lt;h3 class="effect-n"&gt;Vapour around me&lt;/h3&gt;
</pre>
<p>As you can see, the last menu item will receive the respective ID and the h3 will receive a class with the same name. So, when we hover over that menu item, all the other elements (that have the previous effect classes) will be animated, except this one.</p>
<p>Now, let&#8217;s look at the JavaScript.<br />
Let&#8217;s start by caching some elements:</p>
<pre class="brush:js">
var $menu			= $('#menu'),
	$container		= $('#container'),
	$content		= $container.find('.content');
</pre>
<p>We will add the classes for the effects using jQuery instead of going to each single element in the HTML and adding it &#8220;manually&#8221;:</p>
<pre class="brush:js">
$content
.find('p')
.addClass('effect e-fade')
.end()
.find('h1, h2, h3')
.addClass('effect e-fade e-color');
</pre>
<p>Now we will get all the elements that have the class &#8220;effect&#8221; and define the OverlayEffect function that will take care of the animations:</p>
<pre class="brush:js">
var $elems			= $(document).find('.effect'),
	OverlayEffect 	= (function(){
			//speed for animations
		var speed				= 1000,
			//the event that triggers the effect
			eventOff			= 'mouseenter',
			//the event that stops the effect
			eventOn				= 'mouseleave',
			//this is the color that the elements will have after eventOff
			colorOff			= '#AAAAAA',
			//saves the original color of each e-color element,
			//and calls the methods to initialize the events
			init				= function() {
				$elems.each(function(){
					var $el		= $(this);
					if($el.hasClass('e-color'))
						$el.data('original-color',$el.css('color'));
				});
				initEventsHandler();
			},
			//initializes the events eventOff / eventOn
			initEventsHandler 	= function() {
				$menu
				.delegate('a',eventOff,function(e){
					//relation is the id of the element,
					//and the class of related elements
					var relation	= $(this).attr('id');
					animateElems('off',relation);
					return false;
				})
				.delegate('a',eventOn,function(e){
					var relation	= $(this).attr('id');
					animateElems('on',relation);
					return false;
				});
			},
			//animates the color and / or opacity
			animateElems		= function(dir,relation) {
				var $e	= $elems;

				switch(dir){
					case 'on'	:
				//if there are elements on the page with class = relation
				//then these elements will be excluded from the animation
						if(relation)
							$e	= $elems.not('.'+relation);

						$e.each(function(){
							var $el		= $(this),
								color	= $el.data('original-color'),
								param	= {};

							if($el.hasClass('e-color'))
								param.color		= color;
							if($el.hasClass('e-fade'))
								param.opacity	= 1;

							$el.stop().animate(param,speed);
						});

						break;
					case 'off'	:
						if(relation)
							$e	= $elems.not('.'+relation);

						$e.each(function(){
							var $el		= $(this),
								param	= {};

							if($el.hasClass('e-color'))
								param.color		= colorOff;
							if($el.hasClass('e-fade'))
								param.opacity	= 0.1;

							$el.stop().animate(param,speed);
						});

						break;
				}
			};

		return {
			init				: init
		};
	})();

/*
call the init method of OverlayEffect
*/
OverlayEffect.init();
});
</pre>
<p>And that&#8217;s it!<br />
I hope you enjoyed this tutorial and find it useful! </p>
<p><a class="demo" href="http://tympanus.net/Tutorials/OverlayLikeEffect/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/OverlayLikeEffect/OverlayLikeEffect.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/02/15/overlay-like-effect/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Portfolio Zoom Slider with jQuery</title>
		<link>http://tympanus.net/codrops/2010/12/27/portfolio-zoom-slider/</link>
		<comments>http://tympanus.net/codrops/2010/12/27/portfolio-zoom-slider/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 18:17:13 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=3206</guid>
		<description><![CDATA[View demoDownload source In this tutorial we are going to create some nice effects for a portfolio or similar website with jQuery. We will create a tiny slider and integrate it with the amazing Cloud Zoom plugin and the elegant Fancybox plugin. The idea is to give the user the option to view details of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/PortfolioZoomSlider/" target="_blank"><img class="aligncenter size-full wp-image-3209" title="PortfolioZoomSlider" src="http://tympanus.net/codrops/wp-content/uploads/2010/12/PortfolioZoomSlider.jpg" alt="" width="580" height="315" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/PortfolioZoomSlider/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/PortfolioZoomSlider/PortfolioZoomSlider.zip">Download source</a></p>
<p>In this tutorial we are going to create some nice effects for a portfolio or similar website with jQuery. We will create a tiny slider and integrate it with the amazing <a href="http://www.professorcloud.com/mainsite/cloud-zoom.htm" target="_blank">Cloud Zoom plugin</a> and the elegant <a href="http://fancybox.net/" target="_blank">Fancybox plugin</a>.</p>
<p>The idea is to give the user the option to view details of a portfolio item by zooming it on hover, and to allow a full view by clicking. Moreover, we want to have a couple of images for each item, hence we will create a slider.</p>
<p>When integrating jQuery scripts, it sometimes happens that there are conflicts, be it because of some shared attribute or because of some specific structure that is needed by each jQuery plugin. In this tutorial we will bump into some of these conflicts and we will adapt some lines of code in order to bypass them.</p>
<p>So, let&#8217;s start with the markup!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>For each item we will have a div element. There we will add an element for the thumbnails slider which we will give the class &#8220;thumb_wrapper&#8221; and an element for the description with the respective class name:</p>
<pre class="brush:xml">&lt;div class="item"&gt;
	&lt;div class="thumb_wrapper"&gt;
		&lt;div class="thumb"&gt;
			&lt;ul&gt;
				&lt;li&gt;
					&lt;a href="images/formstack1.jpg"&gt;
						&lt;img src="images/thumbs/formstack1.jpg" alt="Formstack 1"/&gt;
					&lt;/a&gt;
				&lt;/li&gt;
				&lt;li&gt;...&lt;/li&gt;
				...
			&lt;/ul&gt;
		&lt;/div&gt;
		&lt;a class="prev" href="#"&gt;&lt;/a&gt;
		&lt;a class="next" href="#"&gt;&lt;/a&gt;
		&lt;span&gt;Hover to zoom, click to view&lt;/span&gt;
	&lt;/div&gt;
	&lt;div class="description"&gt;
		&lt;h2&gt;Portfolio Item&lt;/h2&gt;
		&lt;p&gt;Some description&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The link element which wraps the image will have the href pointing to the large image. Both plugins that we are using take advantage of that structure. They will build their elements with the information provided in the href attribute.</p>
<p>Additonally, we will add the following attributes and class name to each link element:</p>
<pre class="brush:xml">&lt;a rev="group1" rel="zoomHeight:200, zoomWidth:400, adjustX: 10, adjustY:-4, position:'body'" class='cloud-zoom' href="images/formstack1.jpg"&gt;...&lt;/a&gt;
</pre>
<p>The &#8220;rel&#8221; attribute is actually used by both plugins but we will change the Fancybox plugin, so that it used the &#8220;rev&#8221; attribute instead. The Fancybox plugin can create a gallery if we give the same &#8220;rev&#8221; value to a group of images. So, our thumbnails in the first item will all have the &#8220;group1&#8243; rev value and the the thumbnails in the second item will have &#8220;group2&#8243; and so forth.<br />
For configuring the Cloud Zoom plugin, we will add some parameters to the &#8220;rel&#8221; attribute.<br />
For more information on the configuration of the plugins, please visit the <a href="http://www.professorcloud.com/mainsite/cloud-zoom.htm" target="_blank">Cloud Zoom plugin</a> and <a href="http://fancybox.net/" target="_blank">Fancybox plugin</a> websites.<br />
The <strong>position:&#8217;body&#8217;</strong> value is an adapted value that we will come to later, when we go into the jQuery.</p>
<p>Let&#8217;s look at the styling.</p>
<h3>The CSS</h3>
<p>First we will define the style for the item:</p>
<pre class="brush:css">.item{
	float:left;
	width:100%;
	clear:both;
	margin:35px 0px;
}
</pre>
<p>Now, we will position the thumb wrapper which contains the navigation and the thumbnail slider:</p>
<pre class="brush:css">.thumb_wrapper{
	width:290px;
	height:107px;
	position:relative;
	float:left;
	margin:20px 40px 0px 0px;
}
</pre>
<p>The navigation elements will be positioned absolutely. That&#8217;s why we needed to set the parent to a relative position. The common style for both navigation elements is:</p>
<pre class="brush:css">.thumb_wrapper a.prev,
.thumb_wrapper a.next{
	width:30px;
	height:30px;
	position:absolute;
	top:50%;
	margin-top:-15px;
	outline:none;
	cursor:pointer;
}
</pre>
<p>And the individual style for each navigation element is the following:</p>
<pre class="brush:css">.thumb_wrapper a.prev{
	left:0px;
	background:transparent url(../images/fancy_nav_left.png) no-repeat top left;
}
.thumb_wrapper a.next{
	right:0px;
	background:transparent url(../images/fancy_nav_right.png) no-repeat top left;
}
</pre>
<p>The style for the small info span under the slider:</p>
<pre class="brush:css">.thumb_wrapper span{
	display:block;
	text-align:center;
	font-size:11px;
	font-style:italic;
	margin-top:3px;
}
</pre>
<p>The thumb element is the container for the unordered list of thumbnails. We will set the overflow to hidden, since we don&#8217;t want our list to show:</p>
<pre class="brush:css">.thumb{
	margin-left:40px;
	width:210px;
	height:107px;
	overflow:hidden;
	-moz-box-shadow:1px 1px 3px #555;
	-webkit-box-shadow:1px 1px 3px #555;
	box-shadow:1px 1px 3px #555;
}
</pre>
<p>The ul for the thumbnails will have a dynamically calculated width which will overwrite the following one:</p>
<pre class="brush:css">.thumb ul{
	list-style:none;
	width:800px;
	height:107px;
}
</pre>
<p>The list items have to flow left so that we have all the thumbnails in a line. The idea is, to animate the ul to the right position, revealing the next/previous thumbnail in our &#8220;line&#8221;.</p>
<pre class="brush:css">.thumb ul li{
	float:left;
}
</pre>
<p>Let&#8217;s decorate the thumbnail images:</p>
<pre class="brush:css">.thumb ul li a img{
	border:5px solid #fff;
}
</pre>
<p>The description will be floating right of the slider:</p>
<pre class="brush:css">.description{
	width:620px;
	float:right;
}
</pre>
<p>And that was all the style! That&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>The main idea is to create a little slider where the user can navigate through the thumbnails of a portfolio item. Then, when hovering over the thumbnail, we want a zoomed version of the hovered part of the thumbnail to appear on the right side. When clicking on a thumbnail, we want the Fancybox to appear, allowing the user to view the full image and navigate through the set.</p>
<p>So, we will start by including the necessary stylesheets and scripts. First, we will add the stylesheets to the head of our HTML:</p>
<pre class="brush:xml">&lt;link rel="stylesheet" type="text/css" href="cloud-zoom/cloud-zoom.css" /&gt;
&lt;link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" /&gt;
</pre>
<p>Then, we will add all the scripts in the end of the HTML:</p>
<pre class="brush:xml">&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="fancybox/jquery.easing-1.3.pack.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="cloud-zoom/cloud-zoom.1.0.2.js"&gt;&lt;/script&gt;
</pre>
<p>In our jQuery function we will first initialize the Fancybox and then we will define the functionality of the slider. As mentioned before, the Cloud Zoom plugin parameters are set in the &#8220;rel&#8221; attribute of the link element that wraps the thumbnail image.</p>
<p>Let&#8217;s initialize the Fancybox:</p>
<pre class="brush:js">$("#content .cloud-zoom").fancybox({
	'transitionIn'	:	'elastic',
	'transitionOut'	:	'none',
	'speedIn'		:	600,
	'speedOut'		:	200,
	'overlayShow'	:	true,
	'overlayColor'	:	'#000',
	'cyclic'		:	true,
	'easingIn'		:	'easeInOutExpo'
});
</pre>
<p>We need to deal with a conflict now, which is caused by the Cloud Zoom Plugin adding a div element on top of our link element. It conflicts with the Fancybox Plugin since we cannot click the link element anymore (it&#8217;s covered). So, we will add a little function that will trigger the click on the link element whenever we click on the div with the class &#8220;mousetrap&#8221; that gets generated by the Cloud Zoom Plugin:</p>
<pre class="brush:js">$("#content .mousetrap").live('click',function(){
	$(this).prev().trigger('click');
});
</pre>
<p>Now, we will define some variables for our slider:</p>
<pre class="brush:js">var $content	= $('#content'),
$thumb_list = $content.find('.thumb &gt; ul');
</pre>
<p>The slider ul needs to get a width assigned to it which will be the sum of the widths of each thumbnail inside. We will also define the click events on the navigation buttons:</p>
<pre class="brush:js">$thumb_list.each(function(){
	var $this_list	= $(this),
	total_w		= 0,
	loaded		= 0,
	//preload all the images first
	$images		= $this_list.find('img'),
	total_images= $images.length;
	$images.each(function(){
		var $img	= $(this);
		$('<img alt="" />').load(function(){
			++loaded;
			if (loaded == total_images){
				$this_list.data('current',0).children().each(function(){
					total_w	+= $(this).width();
				});
				$this_list.css('width', total_w + 'px');

				//next / prev events

				$this_list.parent()
				.siblings('.next')
				.bind('click',function(e){
					var current = $this_list.data('current');
					if(current == $this_list.children().length -1) return false;
					var	next	= ++current,
					ml		= -next * $this_list.children(':first').width();

					$this_list.data('current',next)
					.stop()
					.animate({
						'marginLeft'	: ml + 'px'
					},400);
					e.preventDefault();
				})
				.end()
				.siblings('.prev')
				.bind('click',function(e){
					var current = $this_list.data('current');
					if(current == 0) return false;
					var	prev	= --current,
					ml		= -prev * $this_list.children(':first').width();

					$this_list.data('current',prev)
					.stop()
					.animate({
						'marginLeft'	: ml + 'px'
					},400);
					e.preventDefault();
				});
			}
		}).attr('src',$img.attr('src'));
	});
});
</pre>
<p>And that&#8217;s all! We adapted the Fancybox script slightly in order to show the navigation arrows constantly when hovering over the full image. Also, we adapted the z-indexes of the Fancybox elements in the stylesheet (we added 10000 to each z-index) in order to work with the other elements in the page and the Cloud Zoom elements. In the Cloud Zoom script we added another case for the position, since we need to append the zoom element to the body using the absolute positions of the thumbnails.</p>
<p>We hope you enjoyed the tutorial and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/PortfolioZoomSlider/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/PortfolioZoomSlider/PortfolioZoomSlider.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/12/27/portfolio-zoom-slider/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>Overlay Effect Menu with jQuery</title>
		<link>http://tympanus.net/codrops/2010/11/25/overlay-effect-menu/</link>
		<comments>http://tympanus.net/codrops/2010/11/25/overlay-effect-menu/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 21:11:45 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[slide out]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=3119</guid>
		<description><![CDATA[View demoDownload source In this tutorial we are going to create a simple menu that will stand out once we hover over it by covering everything except the menu with a dark overlay. The menu will stay white and a submenu area will expand. We will create this effect using jQuery. So, let&#8217;s start! The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/OverlayEffectMenu/" target="_blank"><img class="aligncenter size-full wp-image-3124" title="overlayEffectMenu" src="http://tympanus.net/codrops/wp-content/uploads/2010/11/overlayEffectMenu.jpg" alt="" width="580" height="315" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/OverlayEffectMenu/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/OverlayEffectMenu/OverlayEffectMenu.zip">Download source</a><br />
In this tutorial we are going to create a simple menu that will stand out once we hover over it by covering everything except the menu with a dark overlay. The menu will stay white and a submenu area will expand. We will create this effect using jQuery.</p>
<p>So, let&#8217;s start!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>The HTML structure will consist of a main wrapper div for the menu which will contain the overlay and the unordered list for the menu. The menu itself will have a link and a div element as submenu in its list elements. Each of the submenu elements will contain lists for the columns of the submenu where each one will have a heading list element:</p>
<pre class="brush:xml">&lt;div class="oe_wrapper"&gt;
	&lt;div id="oe_overlay" class="oe_overlay"&gt;&lt;/div&gt;
	&lt;ul id="oe_menu" class="oe_menu"&gt;
		&lt;li&gt;
			&lt;a href=""&gt;Collections&lt;/a&gt;
			&lt;div&gt;
				&lt;ul&gt;
					&lt;li class="oe_heading"&gt;
						Summer 2011
					&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Milano&lt;/a&gt;&lt;/li&gt;
					...
				&lt;/ul&gt;
				&lt;ul&gt;
					...
				&lt;/ul&gt;
				&lt;ul&gt;
					...
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;a href=""&gt;Projects&lt;/a&gt;
			&lt;div style="left:-111px;"&gt;
				...
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;a href=""&gt;Fragrances&lt;/a&gt;
			&lt;div style="left:-223px;"&gt;
				&lt;ul class="oe_full"&gt;
					&lt;li class="oe_heading"&gt;
						Fashion Fragrances
					&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Deálure&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Violet Woman&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Deep Blue for Men&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;New York, New York&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Illusion&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;&lt;a href=""&gt;Events&lt;/a&gt;
			&lt;div style="left:-335px;"&gt;
				...
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;&lt;a href=""&gt;Stores&lt;/a&gt;
			&lt;div style="left:-447px;"&gt;
				...
			&lt;/div&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>The submenu divs will each have an inline style for the left position. As we will see, when we look at the style, we need to set this value since we want the submenu to be of absolute position, but within a relatively positioned container. So, in order to position all of the submenu divs at the beginning of the whole menu, we need to &#8220;pull&#8221; each div more to the left, hence we will have a negative left value for each div (decrementing 112px).</p>
<p>Let&#8217;s look at the style.</p>
<h3>The CSS</h3>
<p>Make sure, that you reset the styles first (we don&#8217;t want any browser-defined padding or margin for the list). We will start by the overlay for the body, which is a simple div with an initial opacity of 0:</p>
<pre class="brush:css">.oe_overlay{
	background:#000;
	opacity:0;
	position:fixed;
	top:0px;
	left:0px;
	width:100%;
	height:100%;
}
</pre>
<p>The position will be set to fixed, since we want it to always stay on the top left corner filling the whole screen.<br />
The main menu list will have the following style:</p>
<pre class="brush:css">ul.oe_menu{
	list-style:none;
	position:relative;
	margin:30px 0px 0px 40px;
	width:560px;
	float:left;
	clear:both;
}
</pre>
<p>You might want to adapt its floatiness once you are planning to integrate this somewhere on your site. What is important, is the positioning of the list items:</p>
<pre class="brush:css">ul.oe_menu &gt; li{
	width:112px;
	height:101px;
	padding-bottom:2px;
	float:left;
	position:relative;
}
</pre>
<p>They will be positioned relatively so that we can have the absolutely positioned submenu elements.<br />
The anchor of the top layer menu will have the following style, forming the box:</p>
<pre class="brush:css">ul.oe_menu &gt; li &gt; a{
	display:block;
	background-color:#101010;
	color:#aaa;
	text-decoration:none;
	font-weight:bold;
	font-size:12px;
	width:90px;
	height:80px;
	padding:10px;
	margin:1px;
	text-shadow:0px 0px 1px #000;
	opacity:0.8;
}
ul.oe_menu &gt; li &gt; a:hover,
ul.oe_menu &gt; li.selected &gt; a{
	background:#fff;
	color:#101010;
	opacity:1.0;
}
</pre>
<p>In our JavaScript we will add the class &#8220;hovered&#8221; to the main ul, once we move with the mouse over the menu, so that we can change all the anchors to white:</p>
<pre class="brush:css">.oe_wrapper ul.hovered &gt; li &gt; a{
	background:#fff;
	text-shadow:0px 0px 1px #FFF;
}
</pre>
<p>The submenu element will not be visible at the beginning, but only slide in when we hover over a top layer list element:</p>
<pre class="brush:css">ul.oe_menu div{
	position:absolute;
	top:103px;
	left:1px;
	background:#fff;
	width:498px;
	height:180px;
	padding:30px;
	display:none;
}
</pre>
<p>The style for the links inside of the submenu lists:</p>
<pre class="brush:css">ul.oe_menu div ul li a{
	text-decoration:none;
	color:#222;
	padding:2px 2px 2px 4px;
	margin:2px;
	display:block;
	font-size:12px;
}
ul.oe_menu div ul li a:hover{
	background:#000;
	color:#fff;
}
</pre>
<p>One of our submenu lists will be alone, so we want it to take all the space:</p>
<pre class="brush:css">ul.oe_menu div ul.oe_full{
	width:100%;
}
</pre>
<p>And if it&#8217;s not alone, we want it to have a width of 150px, so that we can have 3 floating next to each other:</p>
<pre class="brush:css">ul.oe_menu li ul{
	list-style:none;
	float:left;
	width: 150px;
	margin-right:10px;
}
</pre>
<p>And finally, we want the heading of the submenu list to stand out:</p>
<pre class="brush:css">li.oe_heading{
	color:#aaa;
	font-size:16px;
	margin-bottom:10px;
	padding-bottom:6px;
	border-bottom:1px solid #ddd;
}
</pre>
<p>And that&#8217;s all the style! Let&#8217;s continue with the effects using jQuery.</p>
<h3>The JavaScript</h3>
<p>The main idea is to make an overlay appear that darkens everything on the page except the menu. We guarantee that the overlay stays under the menu because we placed it before the menu in the HTML structure. And the overlay stays on top of everything else because it all comes before in the HTML stucture. So, the z-indexes are in the wanted order. Consider that if you integrate this menu somewhere.</p>
<p>Let&#8217;s first cache some elements:</p>
<pre class="brush:js">var $oe_menu		= $('#oe_menu');
var $oe_menu_items	= $oe_menu.children('li');
var $oe_overlay		= $('#oe_overlay');
</pre>
<p>When we hover any of the menu items, we will add the classes &#8220;slided&#8221; and &#8220;selected&#8221; to the item. The corresponding submenu div will get slided out and all the other ones will get hidden. We also give a very high z-index to the current submenu. When we move the mouse out, we will remove the class &#8220;selected&#8221;:</p>
<pre class="brush:js">$oe_menu_items.bind('mouseenter',function(){
	var $this = $(this);
	$this.addClass('slided selected');
	$this.children('div').css('z-index','9999').stop(true,true).slideDown(200,function(){
		$oe_menu_items.not('.slided').children('div').hide();
		$this.removeClass('slided');
	});
}).bind('mouseleave',function(){
	var $this = $(this);
	$this.removeClass('selected').children('div').css('z-index','1');
});
</pre>
<p>The class &#8220;selected&#8221; is needed for the style, while the class &#8220;slided&#8221; is a helper class that let&#8217;s us identify which item is currently &#8220;in use&#8221;.</p>
<p>Now, we will take care of the overlay by defining what happens when we enter the whole menu wrapper. We will fade the overlay to an opacity of 0.6 and add the class &#8220;hovered&#8221; to the wrapper, so that the anchors stay white:</p>
<pre class="brush:js">$oe_menu.bind('mouseenter',function(){
	var $this = $(this);
	$oe_overlay.stop(true,true).fadeTo(200, 0.6);
	$this.addClass('hovered');
}).bind('mouseleave',function(){
	var $this = $(this);
	$this.removeClass('hovered');
	$oe_overlay.stop(true,true).fadeTo(200, 0);
	$oe_menu_items.children('div').hide();
})
</pre>
<p>And that&#8217;s it! We hope you had fun with this tutorial and found it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/OverlayEffectMenu/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/OverlayEffectMenu/OverlayEffectMenu.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/11/25/overlay-effect-menu/feed/</wfw:commentRss>
		<slash:comments>83</slash:comments>
		</item>
		<item>
		<title>Annotation Overlay Effect with jQuery</title>
		<link>http://tympanus.net/codrops/2010/10/12/annotation-overlay-effect/</link>
		<comments>http://tympanus.net/codrops/2010/10/12/annotation-overlay-effect/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 16:00:45 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[annotations]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2842</guid>
		<description><![CDATA[View demoDownload source Today we will create a simple overlay effect to display annotations in e.g. portfolio items of a web designers portfolio. We got the idea from the wonderful portfolio of www.rareview.com where Flash is used to create the effect. We will use jQuery. The Website Templates that we will be using for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/AnnotationOverlayEffect/" target="_blank"><img class="aligncenter size-full wp-image-2848" title="annotationoverlayeffect" src="http://tympanus.net/codrops/wp-content/uploads/2010/10/annotationoverlayeffect.jpg" alt="" width="580" height="315" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/AnnotationOverlayEffect/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/AnnotationOverlayEffect/AnnotationOverlayEffect.zip">Download source</a></p>
<p>Today we will create a simple overlay effect to display annotations in e.g. portfolio items of a web designers portfolio. We got the idea from the wonderful portfolio of <a href="http://www.rareview.com/" target="_blank">www.rareview.com</a> where Flash is used to create the effect. We will use jQuery.</p>
<p>The Website Templates that we will be using for the annotated screenshots were found via the great Honkiat.com post <a href="http://www.hongkiat.com/blog/60-high-quality-free-web-templates-and-layouts/" target="_blank">60 High Quality Free Web Templates and Layouts</a></p>
<p>So, let&#8217;s start with the markup!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>The HTML is pretty simple: we have a main &#8220;portfolio&#8221; wrapper where we add the &#8220;portfolio_item&#8221; elements. Each of the elements has an &#8220;image_wrap&#8221; with the screenshot of the website, and a &#8220;zoom_overlay&#8221; with an image of the website notes inside:</p>
<pre class="brush:xml">&lt;div class="portfolio"&gt;
	&lt;div class="portfolio_item"&gt;
		&lt;div class="image_wrap"&gt;
			&lt;img src="images/website1.jpg" alt="Website1"/&gt;
		&lt;/div&gt;
		&lt;div class="zoom_overlay"&gt;
			&lt;img src="images/website1_notes.png" alt="Website1Notes"/&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	...
&lt;/div&gt;</pre>
<p>Let&#8217;s style the whole thing.</p>
<h3>The CSS</h3>
<p>We will start by styling the big portfolio wrapper:</p>
<pre class="brush:css">.portfolio{
	width:500px;
	margin:0 auto;
	position:relative;
}</pre>
<p>The portfolio items will have the following style:</p>
<pre class="brush:css">.portfolio_item{
	position:relative;
	margin:30px auto;
}</pre>
<p>The image_wrap div that contains the screenshot that we see initially, will have a table-cell display because we want to center the image inside vertically:</p>
<pre class="brush:css">.image_wrap{
	width:500px;
	height:500px;
	display:table-cell;
	text-align:center;
	vertical-align:middle;
	position:relative;
	cursor:pointer;
}</pre>
<p>We will center the image horizontally by saying text-align:center. This works because an image has a default display of &#8220;inline&#8221;.</p>
<p>We will add a nice shadow around the image:</p>
<pre class="brush:css">.image_wrap &gt; img{
	vertical-align:middle;
	margin:0 auto;
	position:relative;
	-moz-box-shadow:1px 1px 7px #000;
	-webkit-box-shadow:1px 1px 7px #000;
	box-shadow:1px 1px 7px #000;
}</pre>
<p>For our jQuery effect, we will want to animate the width of the image. The horizontal alignment should make the image be in the middle but the text-align property is not enough. We also need to add the auto margins to the sides to make the animation work.</p>
<p>The overlay div will be place absolutely, since we want it to appear on top of the image. To center it, we will apply the 50% negative margins trick:</p>
<pre class="brush:css">.zoom_overlay{
	width:400px;
	height:400px;
	margin:-200px 0px 0px -200px;
	background:transparent url(../images/overlay.png) repeat top left;
	position:absolute;
	top:50%;
	left:50%;
	display:none;
	opacity:0;
	-moz-border-radius:10px;
	-webkit-border-radius:10px;
	border-radius:10px;
	cursor:pointer;
	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
}</pre>
<p>The opacity is set to 0 because we will want to animate it when we show it.</p>
<p>The image with the notes will be hidden initially:</p>
<pre class="brush:css">.zoom_overlay img{
	display:none;
}</pre>
<p>And that&#8217;s the style! Let&#8217;s add the magic!</p>
<h3>The JavaScript</h3>
<p>The main idea behind the effect is to make the screenshot smaller and make an overlay with the annotations appear on top of it.<br />
In our jQuery function we will first store the main div in a variable:</p>
<pre class="brush:js">var $portfolio	= $('#portfolio');</pre>
<p>Then we define what happens when we click on the screenshot. We will animate the image&#8217;s height and width and make the overlay appear. The overlay will animate in opacity, width, height and in margins since we want it to be centered. Remember, we were positioning it absolutely with a top and left of 50%:</p>
<pre class="brush:js">$portfolio.find('.image_wrap').bind('click',function(){
	var $elem	= $(this);
	var $image	= $elem.find('img:first');
	$image.stop(true)
		  .animate({
			'width'	:'400px',
			'height':'400px'
		  },250);

	//the overlay is the next element
	var opacity	= '1';
	if($.browser.msie)
		opacity	= '0.5'
	$elem.next()
		 .stop(true)
		 .animate({
			'width'		:'500px',
			'height'	:'500px',
			'marginTop'	:'-250px',
			'marginLeft':'-250px',
			'opacity'	:opacity
		},250,function(){
			//fade in the annotations
			$(this).find('img').fadeIn();
		});
});</pre>
<p>Now, we will define what happens when we click on the overlay. We will want it to disappear and make the image animate back to its initial size:</p>
<pre class="brush:js">$portfolio.find('.zoom_overlay').bind('click',function(){
	var $elem	= $(this);
	var $image	= $elem.prev()
					   .find('img:first');
	//hide overlay
	$elem.find('img')
		 .hide()
		 .end()
		 .stop(true)
		 .animate({
			'width'		:'400px',
			'height'	:'400px',
			'marginTop'	:'-200px',
			'marginLeft':'-200px',
			'opacity'	:'0'
		 },125,function(){
			//hide overlay
			$(this).hide();
		 });

	//show image
	$image.stop(true)
		  .animate({
			'width':'500px',
			'height':'500px'
		  },250);
});</pre>
<p>And that&#8217;s it!<br />
To integrate this into your portfolio you need to make some transparent image with some notes that fits on the smaller sized image.</p>
<p>We hope you enjoyed this effect and found it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/AnnotationOverlayEffect/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/AnnotationOverlayEffect/AnnotationOverlayEffect.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/10/12/annotation-overlay-effect/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Collective: ChillBox Project</title>
		<link>http://tympanus.net/codrops/2010/09/29/collective-chillbox-project/</link>
		<comments>http://tympanus.net/codrops/2010/09/29/collective-chillbox-project/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 06:49:49 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2805</guid>
		<description><![CDATA[Designed by Christopher Hill, and inspired by Lokesh Dhakar\&#8217;s Lightbox2, ChillBox is a JQuery Plugin is a simple, unobtrusive script used to overlay images on top of the current page. It can be used for link anchor attributes. ChillBox has been tested with IE6, IE7, IE8, Firefox, Google Chrome, Opera and Safari. Source http://www.chillwebdesigns.co.uk/chillbox.html Demo [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://www.chillwebdesigns.co.uk/chillbox.html"><img src="http://tympanus.net/codrops/wp-content/uploads/2010/09/chillbox.gif" alt="" title="chillbox" width="580" height="334" class="aligncenter size-full wp-image-2806" /></a></p>
<p>Designed by Christopher Hill, and inspired by Lokesh Dhakar\&#8217;s Lightbox2, ChillBox is a JQuery Plugin is a simple, unobtrusive script used to overlay images on top of the current page. It can be used for link anchor attributes. ChillBox has been tested with IE6, IE7, IE8, Firefox, Google Chrome, Opera and Safari.</p>
<h3>Source</h3>
<p><a href="http://www.chillwebdesigns.co.uk/chillbox.html" target="_blank">http://www.chillwebdesigns.co.uk/chillbox.html</a></p>
<h3>Demo</h3>
<p><a href="http://www.chillwebdesigns.co.uk/chillbox.html" target="_blank">http://www.chillwebdesigns.co.uk/chillbox.html</a></p>
<div style="margin-bottom:100px;"></div>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/09/29/collective-chillbox-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Highlighting and Preview with jQuery</title>
		<link>http://tympanus.net/codrops/2010/07/04/image-highlighting-preview/</link>
		<comments>http://tympanus.net/codrops/2010/07/04/image-highlighting-preview/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 19:15:12 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[preview]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2515</guid>
		<description><![CDATA[View demoDownload source In this tutorial we will show you how to highlight and preview images that are integrated in an article or spread over a page. This is a nice way to allow users to view a bigger version of an image that is relevant to some context. We will highlight images on a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/ImageHighlighter/" target="_blank"><img class="aligncenter size-full wp-image-2529" title="imagehighlight" src="http://tympanus.net/codrops/wp-content/uploads/2010/07/imagehighlight.jpg" alt="" width="580" height="315" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/ImageHighlighter/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/ImageHighlighter/ImageHighlighter.zip">Download source</a></p>
<p>In this tutorial we will show you how to highlight and preview images that are integrated in an article or spread over a page. This is a nice way to allow users to view a bigger version of an image that is relevant to some context. We will highlight images <strong>on a delayed hover</strong> and offer a preview mode which will enlarge and center the bigger version of the image on the screen.</p>
<p>Let&#8217;s start!</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 simply need to consider the image and its class. The image can be placed anywhere in your website:</p>
<pre class="brush:xml">&lt;img src="images/thumbs/1.jpg" alt="images/1.jpg" class="ih_image"/&gt;
</pre>
<p>We use the alt attribute to add the reference to the bigger image.</p>
<p>We will also add an overlay element before the body ends:</p>
<pre class="brush:xml">&lt;div id="ih_overlay" class="ih_overlay" style="display:none;"&gt;&lt;/div&gt;
</pre>
<p>The structure that we will be creating with the JavaScript will look as follows:</p>
<pre class="brush:xml">&lt;div id="ih_clone" class="ih_image_clone_wrap"&gt;
	&lt;span class="ih_close"&gt;&lt;/span&gt;
	&lt;img class="preview" src="images/1.jpg"&gt;
&lt;/div&gt;
</pre>
<p>This structure will <strong>not</strong> be placed in our HTML &#8211; it will be created dynamically.</p>
<p>Now, let&#8217;s take a look at the style.</p>
<h3>The CSS</h3>
<p>First, we will define the style for the overlay:</p>
<pre class="brush:css">.ih_overlay{
	position:fixed;
	top:0px;
	left:0px;
	right:0px;
	bottom:0px;
	background:#000;
	z-index:10;
	opacity:0.9;
	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=90);
}
</pre>
<p>The filter property is used for applying transparency in IE. We make the overlay fixed in order to always be shown, even if we scroll the page.</p>
<p>The image that we want to apply our effect to will have the following style:</p>
<pre class="brush:css">img.ih_image{
	margin:10px 0px;
	position:relative;
	-moz-box-shadow:1px 1px 4px #000;
	-webkit-box-shadow:1px 1px 4px #000;
	box-shadow:1px 1px 4px #000;
	opacity:0.7;
	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=70);
}
</pre>
<p>It&#8217;s pretty plain, we just add some box shadow to it.</p>
<p>In our JavaScript we will create a wrapper that contains a clone of the image that we are hovering. It will get the same positions as the current image. That&#8217;s why we do not define the top and left here, but dynamically in the JS.</p>
<pre class="brush:css">.ih_image_clone_wrap{
	position:absolute;
	z-index:11;
}
</pre>
<p>We will also add some spans with icons that will either show a magnifying glass, a loading image or a cross. We define all common properties as follows:</p>
<pre class="brush:css">.ih_image_clone_wrap span.ih_zoom,
.ih_image_clone_wrap span.ih_loading,
.ih_image_clone_wrap span.ih_close{
	position:absolute;
	top:10px;
	right:10px;
	width:24px;
	height:24px;
	-moz-border-radius:6px;
	-webkit-border-radius:6px;
	border-radius:6px;
	opacity:0.8;
	cursor:pointer;
	-moz-box-shadow:1px 1px 2px #000;
	-webkit-box-shadow:1px 1px 2px #000;
	box-shadow:1px 1px 2px #000;
	z-index:999;
	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80);
}
</pre>
<p>The specific properties for each class, like the background, will be defined as follows:</p>
<pre class="brush:css">.ih_image_clone_wrap span.ih_zoom{
	background:#000 url(../icons/zoom.png) no-repeat center center;
}
.ih_image_clone_wrap span.ih_loading{
	background:#000 url(../icons/loader.gif) no-repeat center center;
}
.ih_image_clone_wrap span.ih_close{
	background:#000 url(../icons/close.png) no-repeat center center;
}
.ih_image_clone_wrap img{
	opacity:0.7;
	-moz-box-shadow:1px 1px 10px #000;
	-webkit-box-shadow:1px 1px 10px #000;
	box-shadow:1px 1px 10px #000;
	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=70);
}
</pre>
<p>The full sized image that we will load on top of the thumbnail, will have the following style:</p>
<pre class="brush:css">.ih_image_clone_wrap img.preview{
	opacity:1;
	position:absolute;
	top:0px;
	left:0px;
}
</pre>
<p>And now, let&#8217;s add some magic!</p>
<h3>The JavaScript</h3>
<p>In our jQuery function we will start by defining a variable to control the timing of the highlight effect.<br />
When we hover over an image with the specific class we create our div with the class <strong>ih_image_clone_wrap</strong> and define its position by getting the position of the current image.</p>
<pre class="brush:js">/**
* timeout to control the display of the overlay/highlight
*/
var highlight_timeout;

/**
* user hovers one image:
* create a absolute div with the same image inside,
* and append it to the body
*/
$('img.ih_image').bind('mouseenter',function () {
		var $thumb = $(this);

		var $clone = $('&lt;div /&gt;',{
			'id'		: 'ih_clone',
			'className'	: 'ih_image_clone_wrap',
			'html'     	: '&lt;img src="' + $thumb.attr('src') + '" alt="' + $thumb.attr('alt') + '"/&gt;&lt;span class="ih_zoom"&gt;&lt;/span&gt;',
			'style'		: 'top:' + $thumb.offset().top + 'px;left:' + $thumb.offset().left + 'px;'
		});

		var highlight = function (){
			$('#ih_overlay').show();
			$('BODY').append($clone);
		}
		//show it after some time ...
		highlight_timeout = setTimeout(highlight,700);

		/**
		* when we click on the zoom,
		* we display the image in the center of the window,
		* and enlarge it to the size of the real image,
		* fading this one in, after the animation is over.
		*/
		$clone.find('.ih_zoom').bind('click',function(){
			var $zoom = $(this);
			$zoom.addClass('ih_loading').removeClass('ih_zoom');
			var imgL_source = $thumb.attr('alt');

			$('&lt;img class="ih_preview" style="display:none;"/&gt;').load(function(){
				var $imgL = $(this);
				$zoom.hide();
				var windowW = $(window).width();
				var windowH = $(window).height();
				var windowS = $(window).scrollTop();

				$clone.append($imgL).animate({
					'top'			: windowH/2 + windowS + 'px',
					'left'			: windowW/2  + 'px',
					'margin-left'	: -$thumb.width()/2 + 'px',
					'margin-top'	: -$thumb.height()/2 + 'px'
				},400,function(){
					var $clone = $(this);
					var largeW = $imgL.width();
					var largeH = $imgL.height();
					$clone.animate({
						'top'			: windowH/2 + windowS + 'px',
						'left'			: windowW/2  + 'px',
						'margin-left'	: -largeW/2 + 'px',
						'margin-top'	: -largeH/2 + 'px',
						'width'			: largeW + 'px',
						'height'		: largeH + 'px'
					},400).find('img:first').animate({
						'width'			: largeW + 'px',
						'height'		: largeH + 'px'
					},400,function(){
						var $thumb = $(this);
						/**
						* fade in the large image and
						* replace the zoom with a cross,
						* so the user can close the preview mode
						*/
						$imgL.fadeIn(function(){
							$zoom.addClass('ih_close')
								 .removeClass('ih_loading')
								 .fadeIn(function(){
									$(this).bind('click',function(){
										$clone.remove();
										clearTimeout(highlight_timeout);
										$('#ih_overlay').hide();
									});
								$(this).bind('click',function(){
									$clone.remove();
									clearTimeout(highlight_timeout);
									$('#ih_overlay').hide();
								});
							});
							$thumb.remove();
						});
					});
				});
			}).error(function(){
				/**
				* error loading image
				* maybe show a message like
				* 'no preview available'?
				*/
				$zoom.fadeOut();
			}).attr('src',imgL_source);
		});
}).bind('mouseleave',function(){
	/**
	* the user moves the mouse out of an image.
	* if there's no clone yet, clear the timeout
	* (user was probably scolling through the article, and
	* doesn't want to view the image)
	*/
	if($('#ih_clone').length) return;
	clearTimeout(highlight_timeout);
});

/**
* the user moves the mouse out of the clone.
* if we don't have yet the cross option to close the preview, then
* clear the timeout
*/
$('#ih_clone').live('mouseleave',function() {
	var $clone = $('#ih_clone');
	if(!$clone.find('.ih_preview').length){
		$clone.remove();
		clearTimeout(highlight_timeout);
		$('#ih_overlay').hide();
	}
});
</pre>
<p>And that&#8217;s all! We hope you enjoyed this tutorial and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ImageHighlighter/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/ImageHighlighter/ImageHighlighter.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/07/04/image-highlighting-preview/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Collective: Griddy: Simple Grid Overlay Plugin for JQuery</title>
		<link>http://tympanus.net/codrops/2010/05/30/collective-griddy-simple-grid-overlay-plugin-for-jquery/</link>
		<comments>http://tympanus.net/codrops/2010/05/30/collective-griddy-simple-grid-overlay-plugin-for-jquery/#comments</comments>
		<pubDate>Sun, 30 May 2010 21:15:21 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2306</guid>
		<description><![CDATA[Often when I’m designing layouts, I know I want to create x number of columns that are spaced y pixels apart. Usually I do the math in my head or if I’m feeling super lazy, I pull out my calculator. While playing with grid overlays earlier today, I decided to make a plugin that automatically [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://devgrow.com/griddy-overlay/"><img src="http://tympanus.net/codrops/wp-content/uploads/2010/05/ScreenHunter_05-May.-30-23.11.gif" alt="" title="ScreenHunter_05 May. 30 23.11" width="580" height="386" class="aligncenter size-full wp-image-2307" /></a></p>
<p>Often when I’m designing layouts, I know I want to create x  number of columns that are spaced y pixels apart. Usually I do the math in my head or if I’m feeling super lazy, I pull out my calculator. While playing with grid overlays earlier today, I decided to make a plugin that automatically calculates column width and row height based on the number of rows or columns present and overlays an appropriately sized grid.<br />
Griddy is a small JQuery plugin thats creates a simple, customizable grid overlay on top of any element. It can also calculate row heights and column widths automatically based on the number of rows/columns and gutter space.</p>
<h3>Source</h3>
<p><a href="http://devgrow.com/griddy-overlay/" target="_blank">http://devgrow.com/griddy-overlay/</a></p>
<h3>Demo</h3>
<p><a href="http://devgrow.com/griddy/" target="_blank">http://devgrow.com/griddy/</a></p>
<div style="margin-bottom:100px;"></div>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/05/30/collective-griddy-simple-grid-overlay-plugin-for-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collective: Lightbox_me</title>
		<link>http://tympanus.net/codrops/2010/05/30/collective-lightbox_me/</link>
		<comments>http://tympanus.net/codrops/2010/05/30/collective-lightbox_me/#comments</comments>
		<pubDate>Sun, 30 May 2010 21:09:11 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2302</guid>
		<description><![CDATA[Have you ever had a DOM element that you wanted lightboxed, but didn&#8217;t want all the fanciness of all the lightbox-related plug-ins out there? Lightbox_me is for you. Lightbox_me is an essential tool for the jQuery developer&#8217;s toolbox. Feed it a DOM element wrapped in a jQuery object and it will lightbox it for you, [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://buckwilson.me/lightboxme/"><img src="http://tympanus.net/codrops/wp-content/uploads/2010/05/lightboxme.gif" alt="" title="lightboxme" width="580" height="390" class="aligncenter size-full wp-image-2303" /></a></p>
<p>Have you ever had a DOM element that you wanted lightboxed, but didn&#8217;t want all the fanciness of all the lightbox-related plug-ins out there? Lightbox_me is for you.<br />
Lightbox_me is an essential tool for the jQuery developer&#8217;s toolbox. Feed it a DOM element wrapped in a jQuery object and it will lightbox it for you, no muss no fuss. </p>
<h3>Source</h3>
<p><a href="http://buckwilson.me/lightboxme/" target="_blank">http://buckwilson.me/lightboxme/</a></p>
<h3>Demo</h3>
<p><a href="http://buckwilson.me/lightboxme/" target="_blank">http://buckwilson.me/lightboxme/</a></p>
<div style="margin-bottom:100px;"></div>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/05/30/collective-lightbox_me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS and jQuery Tutorial: Overlay with Slide Out Box</title>
		<link>http://tympanus.net/codrops/2009/12/03/css-and-jquery-tutorial-overlay-with-slide-out-box/</link>
		<comments>http://tympanus.net/codrops/2009/12/03/css-and-jquery-tutorial-overlay-with-slide-out-box/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 23:38:19 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[slide out]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=961</guid>
		<description><![CDATA[The other day I was creating an overlay with a box for Cody&#8217;s jTextTranslate jQuery Plugin and I thought, it could be useful to describe the technique in a tutorial. So, I want to show you how to create a semi-transparent overlay that covers all the page, and a message box that can be turned [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-969" title="CSSOverlay" src="http://tympanus.net/codrops/wp-content/uploads/2009/12/CSSOverlay.gif" alt="CSSOverlay" width="551" height="345" /></p>
<p>The other day I was creating an overlay with a box for Cody&#8217;s <a href="http://tympanus.net/codrops/2009/11/30/jtexttranslate-a-jquery-translation-plugin/" target="_blank">jTextTranslate jQuery Plugin</a> and I thought, it could be useful to describe the technique in a tutorial.</p>
<p>So, I want to show you how to create a semi-transparent overlay that covers all the page, and a message box that can be turned off again. You can see on the screenshot how that will look.</p>
<p>Then I will show you how to add some jQuery that will make the overlay appear and the message box slide down from the top of the page (try the demo at the end of this post).</p>
<p>Ok, let&#8217;s get to work:</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>1. The HTML</h3>
<p>We just need two elements in our HTML: a div for the overlay and a div for the box. The box will contain a link element for a closing icon and some text. And here we go:</p>
<pre class="brush:html">&lt;div class="overlay" id="overlay" style="display:none;"&gt;&lt;/div&gt;

&lt;div class="box" id="box"&gt;
 &lt;a class="boxclose" id="boxclose"&gt;&lt;/a&gt;
 &lt;h1&gt;Important message&lt;/h1&gt;
 &lt;p&gt;
  Here comes a very important message for your user.
  Turn this window off by clicking the cross.
 &lt;/p&gt;
&lt;/div&gt;</pre>
<p>Since we will be referring to these two main elements in the JavaScript later, we should already give them IDs. You can place the overlay and the box div anywhere in your site as a direct child of the body.</p>
<p>The overlay is getting a style tag with display:none since we want it not to be visible initially. The visibility of the box will be handled in the CSS.</p>
<p>Let&#8217;s give them some style.</p>
<h3>2. The CSS</h3>
<p>For the overlay we will simply use a transparent image that will be repeated. We could as well just give it a dark background color and make it transparent with CSS properties, but for now, we will use an image:</p>
<pre class="brush:css">.overlay{
    background:transparent url(images/overlay.png) repeat top left;
    position:fixed;
    top:0px;
    bottom:0px;
    left:0px;
    right:0px;
    z-index:100;
}</pre>
<p>What we are doing here is to stretch this div by saying that from all sides it&#8217;s position is 0. So, no matter how wide the browser window is, this will always make it being stretched over all the page. Using <strong>position:fixed</strong> will always keep it at 0 no matter where you are in the page, e.g. after scrolling. If we would have used <strong>position:absolute</strong> we would just have the visible (top part of the page) covered, not including the part after we scroll down. The z-index needs to be very high in order to put this element on top of all the others (except the box).</p>
<p>The box will have the following CSS properties:</p>
<pre class="brush:css">.box{
    position:fixed;
    top:-200px;
    left:30%;
    right:30%;
    background-color:#fff;
    color:#7F7F7F;
    padding:20px;
    border:2px solid #ccc;
    -moz-border-radius: 20px;
    -webkit-border-radius:20px;
    -khtml-border-radius:20px;
    -moz-box-shadow: 0 1px 5px #333;
    -webkit-box-shadow: 0 1px 5px #333;
    z-index:101;
}</pre>
<p>Again, we have a <strong>fixed container</strong> here because we want the box to <strong>move along as we scroll</strong>. For the top property we provide a negative value since we want the box to be ouside of our window i.e. not visible in the beginning. We don&#8217;t just say &#8220;display:none&#8221; since we want the box to appear sliding out from the top, hence we need to work with positioning here.</p>
<p>In order to <strong>center</strong> the element on the page we simply give it the <strong>same distance from the right as from the left</strong>. Using percentages allows to adapt elements nicely to all screen sizes &#8211; keep in mind that they can vary extremely.</p>
<p>The CSS3 properties add some rounded borders and some shadow to the box. They will not work  in IE though.</p>
<p>The z-index needs to be bigger than the one of the overlay. Here, we just add one. Make sure, that you don&#8217;t have any absolute positioned elements with a higher z-index.</p>
<p>The closing cross of the box will have the following styling:</p>
<pre class="brush:css">a.boxclose{
    float:right;
    width:26px;
    height:26px;
    background:transparent url(images/cancel.png) repeat top left;
    margin-top:-30px;
    margin-right:-30px;
    cursor:pointer;
}</pre>
<p>This little element should be halfway &#8220;outside&#8221; of the box and since the box has a padding of 20 pixels, we &#8220;pull&#8221; the element up and to the right by giving it a negative margin of -30 pixels for these sides. <strong>Negative margins can be used in a lot of ways to help you position elements, don&#8217;t be afraid to use them, it&#8217;s a good practice trick :) A very useful article about negative margins by Dan Cederholm can be found <a href="http://simplebits.com/notebook/2005/05/23/negative/" target="_blank">here</a>.</strong></p>
<p>The h1 element will get some styling, too:</p>
<pre class="brush:css">.box h1{
    border-bottom: 1px dashed #7F7F7F;
    margin:-20px -20px 0px -20px;
    padding:10px;
    background-color:#FFEFEF;
    color:#EF7777;
    -moz-border-radius:20px 20px 0px 0px;
    -webkit-border-top-left-radius: 20px;
    -webkit-border-top-right-radius: 20px;
    -khtml-border-top-left-radius: 20px;
    -khtml-border-top-right-radius: 20px;
}</pre>
<p>Again, we apply negative margins here to pull the the element into place. Notice, that the CSS3 properties of Mozilla can be written in shorthand.</p>
<p>Okay, that&#8217;s the CSS, now let&#8217;s move to the juicy JavaScript.</p>
<h3>3. The JavaScript</h3>
<p>The following code is added at the end of the HTML right before the closing body tag:</p>
<pre class="brush:js">$(function() {
    $('#activator').click(function(){
        $('#overlay').fadeIn('fast',function(){
            $('#box').animate({'top':'160px'},500);
        });
    });
    $('#boxclose').click(function(){
        $('#box').animate({'top':'-200px'},500,function(){
            $('#overlay').fadeOut('fast');
        });
    });

});</pre>
<p>The #activator element stands for any element in your page that should trigger the overlay and the box to appear. In the demo I simply added a styled link element with that ID.</p>
<p>When that activator element gets clicked, the overlay should fade in really fast (uh, jQuery is just like a natural language&#8230;) and just after that&#8217;s done, another function should be executed that makes the box slide out from the top. That&#8217;s what the animate() does. Then saying that <strong>top</strong> should be <strong>160 pixels</strong> means that we want the box to move from it&#8217;s current position to position top:160px, and that should take 500 milliseconds.</p>
<p>After the overlay and the box have appeared, we want to be able to <strong>turn the box off again</strong> by clicking on the cross icon. The function for that first makes the box slide up again to it&#8217;s old position (top:-200px) and makes the overlay disappear afterward.</p>
<p>Be aware that the initial position of the box of -200px depends on the height of the box. If your box is bigger in height, make sure that the initial top value is lower (i.e. -500px if your box is 500px high).</p>
<p>And that&#8217;s it! Try to experiment with the speeds for the elements to appear. You can replace the &#8216;fast&#8217; for any millisecond value as well. And you can also make the box slide out from the right or the left, for that, you just have to adapt the initial values and the values in the JavaScript functions.</p>
<p>Enjoy!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSSOverlay/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/CSSOverlay/CSSOverlay.zip">Download source</a></p>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2009/12/03/css-and-jquery-tutorial-overlay-with-slide-out-box/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>CSS Tutorial: Image with Toolbar and Navigation Overlay</title>
		<link>http://tympanus.net/codrops/2009/11/23/css-tutorial-image-with-toolbar-navigation-overlay/</link>
		<comments>http://tympanus.net/codrops/2009/11/23/css-tutorial-image-with-toolbar-navigation-overlay/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 08:21:55 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[toolbar]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=822</guid>
		<description><![CDATA[In this tutorial I will show you how to create an overlay toolbar and navigation for an image. This type of technique can, for example, be applied in an image gallery where you want to provide some options for the user when he is viewing your images. The result of this tutorial will look like [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will show you how to create an overlay toolbar and navigation for an image. This type of technique can, for example, be applied in an image gallery where you want to provide some options for the user when he is viewing your images.</p>
<p>The result of this tutorial will look like this:</p>
<p><img class="alignnone size-full wp-image-823" title="csstut_img" src="http://tympanus.net/codrops/wp-content/uploads/2009/11/csstut_img.gif" alt="csstut_img" width="550" height="424" /></p>
<p>As you can see, we will create a toolbar with icons and a navigation bar. In the end we will use some JavaScript (jQuery) in order to make the bars appear and disappear again.</p>
<p>The icons we will be using for this tutorial belong to the incredible <a href="http://min.frexy.com/article/milky_a_free_vector_icon_set_part_1/" target="_blank">Milky</a> icon set. Please visit the site to get the complete icon set by Frexy.</p>
<p><span id="more-822"></span></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>1. The HTML Structure</h3>
<p>Let&#8217;s start by the HTML structure. We will need three main elements inside of a wrapper or container:</p>
<ol>
<li>upper toolbar with 8 tool icons</li>
<li>navigation with previous and next icon, and a price tag</li>
<li>the image itself</li>
</ol>
<p>The upper toolbar will be an unordered list:</p>
<pre class="blue">&lt;ul class="toolbar"&gt;
 &lt;li&gt;&lt;a class="zoomin"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a class="zoomout"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a class="shop"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a class="fav"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a class="edit"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a class="label"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a class="info"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>The navigation bar will be a simple div looking like this:</p>
<pre class="blue">&lt;div class="navigation"&gt;
 &lt;a class="previous"&gt;&lt;/a&gt;
 &lt;a class="next"&gt;&lt;/a&gt;
 &lt;span class="price"&gt;$ 0.99&lt;/span&gt;
&lt;/div&gt;</pre>
<p>Put into a wrapper or container and adding the image we will have a structure like this:</p>
<pre class="blue">&lt;div class="image_container"&gt;
 &lt;ul class="toolbar"&gt;
  &lt;li&gt;&lt;a class="zoomin"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="zoomout"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="shop"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="fav"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="edit"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="label"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="info"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
 &lt;img src="example.jpg" alt="example" width="500" height="375"/&gt;
 &lt;div class="navigation"&gt;
  &lt;a class="previous"&gt;&lt;/a&gt;
  &lt;a class="next"&gt;&lt;/a&gt;
  &lt;span class="price"&gt;$ 0.99&lt;/span&gt;
 &lt;/div&gt;
&lt;/div&gt;</pre>
<h3>2. The CSS</h3>
<p>Now we will add some style to the classes of the HTML elements. The image container shall look like a frame with a neat shadow around. This we can reach with the CSS3 box shadow property that will not work in Internet Explorer, but which will give a nice effect in e.g. Firefox and Chrome. The styling for the container will be the following:</p>
<pre class="yellow">.image_container{
 width:500px;
 height:375px;
 padding:5px;
 background-color:#f7f7f7;
 border:1px solid #ccc;
 -moz-box-shadow: 0 1px 3px #777;
 -webkit-box-shadow: 0 1px 3px #777;
 margin:40px auto;
}</pre>
<p>The image that we are going to use will be 500 pixel wide and 375 pixel high, so we will make the container around it the same size. For the border effect we will not simply add a border, but a background color and some padding. You see, this allows you to add two borders to an image: one is created by the padding and the other by the border.</p>
<p>With setting the left and right margin to auto, we center the div vertically on the page. <strong>Remember the order for the short CSS version: TOP RIGHT BOTTOM LEFT. If you just have two values it is: TOP+BOTTOM RIGHT+LEFT.</strong></p>
<p>Let&#8217;s continue by styling the unordered list for the icons.</p>
<p>Because we want it to appear on top of the image, we need to make the position of the unordered list absolute:</p>
<pre class="yellow">ul.toolbar{
 position:absolute;
 width:500px;
 height:52px;
 margin:0px;
 padding:0px;
 background-color:#fff;
 border-bottom:2px solid #ccc;
 list-style-type:none;
}</pre>
<p>When styling lists, it is always important to keep in mind that they have a <strong>default margin and padding</strong>. In this example, we don&#8217;t want it to have any of these, so we set them to zero. The <strong>list-style-type</strong> should be none, since we don&#8217;t want any little bullet next to our list items.</p>
<p>Now, we want to make the list being in a line. That we need to define in the list elements:</p>
<pre class="yellow">ul.toolbar li{
 display:inline;
}</pre>
<p>When coding CSS, we always want to try to write compact classes and not repeat everything for similar elements. All the <strong>a</strong> elements in our list will have a different icon, so we need to create different classes for them. But, they will also have many properties in common. So, the first step we take, is to define these common properties for the general case:</p>
<pre class="yellow">ul.toolbar li a{
 float:left;
 cursor:pointer;
 width:70px;
 height:52px;
 opacity: 0.6;
}</pre>
<p>The icon itself is 48 pixels wide and high, but we want to give the buttons that we create out of the icons a little bit more space. When styling link elements, one should always keep in mind that they only change the mouse cursor to a little hand, when there is a <strong>href </strong>in them. In our case we will not have a link address, so we set the <strong>cursor property to pointer</strong>. The icons should be a little bit transparent, so we set the <strong>opacity to 0.6</strong>. We want them to become opaque when we hover over them, so we define:</p>
<pre class="yellow">ul.toolbar li a:hover{
 opacity: 1.0;
}</pre>
<p>Now we can define the classes for the icons:</p>
<pre class="yellow">a.label{
 background:#fff url(icons/label.png) no-repeat center center;
}
a.fav{
 background:#fff url(icons/favorite.png) no-repeat center center;
}
a.shop{
 background:#fff url(icons/shopping_cart.png) no-repeat center center;
}
a.zoomin{
 background:#fff url(icons/zoom_in.png) no-repeat center center;
}
a.zoomout{
 background:#fff url(icons/zoom_out.png) no-repeat center center;
}
a.fullscreen{
 background:#fff url(icons/fullscreen.png) no-repeat center center;
}
a.info{
 background:#fff url(icons/info.png) no-repeat center center;
}
a.edit{
 background:#fff url(icons/edit.png) no-repeat center center;
}</pre>
<p>With this styling we are done with the upper toolbar.<br />
The navigation div will have a similar style to the unordered list:</p>
<pre class="yellow">.navigation{
 width:500px;
 height:52px;
 position:absolute;
 margin-top:-58px;
 border-top:2px solid #ccc;
 background-color:#fff;
}</pre>
<p>The <strong>margin-top</strong> gets a negative value because we want to pull the navigation bar up to appear on top of the image. (When making the container relative, we could as well just say e.g. left:0px and bottom:0px.)<br />
The two arrows for the navigation will have the following styling:</p>
<pre class="yellow">a.previous{
 float:left;
 background:#fff url(icons/prev.png) no-repeat center center;
}
a.next{
 float:right;
 background:#fff url(icons/next.png) no-repeat center center;
}</pre>
<p>Since these elements will as well have the same styling like the <strong>a</strong> elements in the upper toolbar, we will just add the class to the already existing css:</p>
<pre class="yellow">ul.toolbar li a<span style="color:red;">, .navigation a</span>{
 float:left;
 cursor:pointer;
 width:70px;
 height:52px;
 opacity: 0.6;
}</pre>
<p>Last but not least, we have the price tag, which has the following styling:</p>
<pre class="yellow">span.price{
 position:absolute;
 color:#888;
 font-weight:bold;
 font-size:26px;
 margin:10px 0px 0px 140px;
}</pre>
<p>The margin of the absolute positioned element allows to position it relative to the containing element. Using e.g. top or left would position an absolute element relative to the page itself.<br />
So, now we are done with the markup and styling and ready to add some magic.</p>
<h3>3. The JavaScript</h3>
<p>We want the toolbar and navigation to appear only when we hover over the image. Further, we want that, when passing over one of the bars, they become opaque.<br />
To achieve these effects we will simply use jQuery. First, we will need to add style for another class to the CSS which will make elements transparent:</p>
<pre class="yellow">.transparent{
 opacity: 0.6;
}</pre>
<p>We will add this class to the toolbar and the navigation. Additionally, we will add a style tag saying that the elements should be invisible:</p>
<pre class="blue">&lt;div class="image_container"&gt;
 &lt;ul class="toolbar <span style="color:red;">transparent" style="display:none;"</span>&gt;
  &lt;li&gt;&lt;a class="zoomin"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="zoomout"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="shop"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="fav"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="edit"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="label"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="info"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
 &lt;img src="example.jpg" alt="example" width="500" height="375"/&gt;
 &lt;div class="navigation <span style="color:red;">transparent" style="display:none;"</span>&gt;
  &lt;a class="previous"&gt;&lt;/a&gt;
  &lt;a class="next"&gt;&lt;/a&gt;
  &lt;span class="price"&gt;$ 0.99&lt;/span&gt;
 &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Since we will use some JavaScript functions acting on the elements, we need to identify them with unique ids:</p>
<pre class="blue">&lt;div class="image_container" <span style="color:red;">id="img_cont"</span>&gt;
 &lt;ul class="toolbar transparent" <span style="color:red;">id="tlbar"</span> style="display:none;"&gt;
  &lt;li&gt;&lt;a class="zoomin"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="zoomout"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="shop"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="fav"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="edit"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="label"&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="info"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
 &lt;img src="example.jpg" alt="example" width="500" height="375"/&gt;
 &lt;div class="navigation transparent" <span style="color:red;">id="nav"</span> style="display:none;"&gt;
  &lt;a class="previous"&gt;&lt;/a&gt;
  &lt;a class="next"&gt;&lt;/a&gt;
  &lt;span class="price"&gt;$ 0.99&lt;/span&gt;
 &lt;/div&gt;
&lt;/div&gt;</pre>
<p>In the head of the document, we need to add a link to the jQuery script:</p>
<pre>&lt;script type="text/javascript" src="jquery-1.3.2.js"&gt;&lt;/script&gt;</pre>
<p>Now we can define some functions before the closing body tag:</p>
<pre class="green">&lt;script&gt;
$(function() {
 $('#img_cont').hover(
   function () {
    $('#tlbar').slideDown(200);
    $('#nav').slideDown(200);
   },
   function () {
    $('#tlbar').slideUp(200);
    $('#nav').slideUp(200);
   }
 );
 $('#tlbar,#nav').hover(
  function () {
   $(this).removeClass('transparent');
  },
  function () {
   $(this).addClass('transparent');
  }
 );
});
&lt;/script&gt;</pre>
<p>We define that we want the toolbar and the navigation bar to appear &#8220;sliding down&#8221; very quickly (200 milliseconds) whenever we hover over the the image container. Then, when hovering over one of the elements, we want them to become opaque. That we achieve by removing the transparent class.<br />
And that&#8217;s  it!<br />
<a class="demo" href="http://tympanus.net/codrops/wp-content/uploads/2009/11/tutorial2211/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/codrops/wp-content/uploads/2009/11/tutorial2211/tutorial2211.zip" target="_blank">Download source</a></p>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2009/11/23/css-tutorial-image-with-toolbar-navigation-overlay/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/tag/overlay/feed/ ) in 0.30895 seconds, on Feb 7th, 2012 at 12:32 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 7th, 2012 at 1:32 pm UTC -->
