<?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; jQuery</title>
	<atom:link href="http://tympanus.net/codrops/tag/jquery/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>3D Gallery with CSS3 and jQuery</title>
		<link>http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/</link>
		<comments>http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 07:30:10 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[jQuery]]></category>

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

autoplay	: false,
// slideshow on / off

interval	: 2000
// time between transitions
</pre>
<p>I hope you enjoy it!</p>
<p><a class="demo" href="http://tympanus.net/Development/3DGallery/">View demo</a> <a class="download" href="http://tympanus.net/Development/3DGallery/3DGallery.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Collective #2</title>
		<link>http://tympanus.net/codrops/collective/collective-2/</link>
		<comments>http://tympanus.net/codrops/collective/collective-2/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 18:47:36 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[contact form]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?post_type=collective&#038;p=7434</guid>
		<description><![CDATA[HTML5 Please * Scrollorama * Font.js * Inspiring UI Elements * CSS3/HTML5 Contact Form * deCSS3 * PSD Freebie]]></description>
			<content:encoded><![CDATA[<div class="ct-coll-item">
<article>
<h2>HTML5 Please &#8211; Use the new and shiny responsibly</h2>
<p>		<a class="ct-coll-thumb" href="http://html5please.us/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_218.jpg" alt="Collective2_218" title="" width="300" height="82" class="alignnone size-full wp-image-7554" /></a></p>
<p>The same brilliant minds that gave us HTML5 Boilerplate, Modernizr &#038; CSS3 Please, now give us HTML5 Please: a very useful resource that summerizes the support and possibilities for all the new properties.</p>
<p>		<a class="ct-coll-link" href="http://html5please.us/">Read it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Scrollorama</h2>
<p>		<a class="ct-coll-thumb" href="http://johnpolacek.github.com/scrollorama/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_213.jpg" alt="Collective2_213" title="" width="200" height="173" class="alignnone size-full wp-image-7549" /></a></p>
<p>Scrollorama is an awesome jQuery plugin by John Polacek for doing cool and experimental scrolly stuff. Just scroll the page and you&#8217;ll discover some nice effects.</p>
<p>		<a class="ct-coll-link" href="http://johnpolacek.github.com/scrollorama/">Check it out</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Font.js &#8211; A Powerful Font Toolkit for JavaScript</h2>
<p>		<a class="ct-coll-thumb" href="http://pomax.nihongoresources.com/pages/Font.js/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_214.jpg" alt="Collective2_214" title="" width="300" height="116" class="alignnone size-full wp-image-7550" /></a></p>
<p>Mike &#8220;Pomax&#8221; Kamermans gives us this useful library that adds a font object to the collection of predefined objects available to you when doing JS coding for the web.</p>
<p>		<a class="ct-coll-link" href="http://pomax.nihongoresources.com/pages/Font.js/">Get it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Kendo UI &#8211; The Art of Web Development</h2>
<p>		<a class="ct-coll-thumb" href="http://www.kendoui.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_215.jpg" alt="Collective2_215" title="" width="230" height="91" class="alignnone size-full wp-image-7551" /></a></p>
<p>Kendo UI combines everything needed for modern JavaScript development, including a powerful DataSource, universal Drag-and-Drop, Templates, Themes, and UI Widgets.</p>
<p>		<a class="ct-coll-link" href="http://www.kendoui.com/">Check it out</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>CSS3/HTML5 Contact Form without Images</h2>
<p>		<a class="ct-coll-thumb" href="http://www.onextrapixel.com/2012/01/23/full-css3-html5-contact-form-with-no-images/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_216.jpg" alt="Collective2_216" title="" width="309" height="144" class="alignnone size-full wp-image-7552" /></a></p>
<p>Stéphanie Walter shows how to create a super-slick HTML5/CSS3 contact form from scratch.</p>
<p>		<a class="ct-coll-link" href="http://www.onextrapixel.com/2012/01/23/full-css3-html5-contact-form-with-no-images/">Read it</a><br />
	</article>
</div>
<div class="ct-coll-item ct-coll-item-multi ct-coll-item-dribbble">
<nav>
		<a href="#" class="ct-coll-nav-prev">Prev</a><br />
		<a href="#" class="ct-coll-nav-next">Next</a><br />
	</nav>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQsO"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/18.jpg" alt="1" title="" width="330" height="248" class="alignnone size-full wp-image-7543" /></a></p>
<p>Glyph Menu by <a href="http://dribbble.com/lewisbraid">Lewis Braid</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cOUI"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/21.jpg" alt="2" title="" width="330" height="248" class="alignnone size-full wp-image-7544" /></a></p>
<p>just.play by <a href="http://dribbble.com/dirkjanhaarsma">Dirk Jan Haarsma</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cPLG"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/31.jpg" alt="3" title="" width="330" height="248" class="alignnone size-full wp-image-7545" /></a></p>
<p>93% love it! by <a href="http://dribbble.com/mhrescak">Matej Hrescak</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRVc"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/41.jpg" alt="4" title="" width="330" height="248" class="alignnone size-full wp-image-7546" /></a></p>
<p>Levels by <a href="http://dribbble.com/falcadia">Chris Kelley</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRtR"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/51.jpg" alt="5" title="" width="330" height="248" class="alignnone size-full wp-image-7547" /></a></p>
<p>Dashboard by <a href="http://dribbble.com/MengTo">Meng To</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRiI"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/61.jpg" alt="6" title="" width="330" height="248" class="alignnone size-full wp-image-7531" /></a></p>
<p>Header Navigation by <a href="http://dribbble.com/Antlam">Anthony Lam</a></p>
</article>
<article>
<h2>Inspiring UI Shots from Dribbble</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRhx"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/71.jpg" alt="7" title="" width="330" height="248" class="alignnone size-full wp-image-7532" /></a></p>
<p>Derailed Ui Set &#8211; Free PSD by <a href="http://dribbble.com/Norm">Norm</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRgZ"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/81.jpg" alt="8" title="" width="330" height="248" class="alignnone size-full wp-image-7533" /></a></p>
<p>On off by <a href="http://dribbble.com/hikim">Hyuk-in Kim</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRdT"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/91.jpg" alt="9" title="" width="330" height="248" class="alignnone size-full wp-image-7534" /></a></p>
<p>Stats by <a href="http://dribbble.com/ryanvsclark">Ryan Clark</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRcD"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/101.jpg" alt="10" title="" width="330" height="248" class="alignnone size-full wp-image-7535" /></a></p>
<p>Deck Mobile Interface by <a href="http://dribbble.com/thiyagus15">thiyagu</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cRcb"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/11.jpg" alt="11" title="" width="330" height="248" class="alignnone size-full wp-image-7536" /></a></p>
<p>Drag by <a href="http://dribbble.com/SmartBink">Arnoud Paauwe</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQZN"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/12.jpg" alt="12" title="" width="330" height="248" class="alignnone size-full wp-image-7537" /></a></p>
<p>Breakpoints by <a href="http://dribbble.com/51bits">Chris Sealey</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQWV"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/13.jpg" alt="13" title="" width="330" height="248" class="alignnone size-full wp-image-7538" /></a></p>
<p>Vertical Nav by <a href="http://dribbble.com/jermshaw">Jeremiah Shaw</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQVL"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/14.jpg" alt="14" title="" width="330" height="248" class="alignnone size-full wp-image-7539" /></a></p>
<p>Dark UI kit &#8211; Free PSD resource by <a href="http://dribbble.com/cleanet">Lukas Troup</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQzO"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/15.jpg" alt="15" title="" width="330" height="248" class="alignnone size-full wp-image-7540" /></a></p>
<p>Calendar by <a href="http://dribbble.com/JJYing">JJ Ying</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQuN"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/16.jpg" alt="16" title="" width="330" height="248" class="alignnone size-full wp-image-7541" /></a></p>
<p>Content Migrator Interface by <a href="http://dribbble.com/alastair-macgregor">Alastair MacGregor</a></p>
</article>
<article>
<h2>Inspiring UI Element Shots</h2>
<p>		<a class="ct-coll-thumb" href="http://drbl.in/cQoy"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/17.jpg" alt="17" title="" width="330" height="248" class="alignnone size-full wp-image-7542" /></a></p>
<p>Simple Download Concept by <a href="http://dribbble.com/JamesCipriano">James Cipriano</a></p>
</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Pick the Right Typefaces for Your Project</h2>
<p>		<a class="ct-coll-thumb" href="http://designshack.net/articles/typography/pick-the-right-typefaces-for-your-project/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_217.jpg" alt="Collective2_217" title="" width="290" height="192" class="alignnone size-full wp-image-7553" /></a></p>
<p>Carrie Cousins explains how to make the right font choices and font combinations.</p>
<p>		<a class="ct-coll-link" href="http://designshack.net/articles/typography/pick-the-right-typefaces-for-your-project/">Read it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Design Curate</h2>
<p>		<a class="ct-coll-thumb" href="http://designcurate.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_212.jpg" alt="Collective2_212" title="" width="300" height="71" class="alignnone size-full wp-image-7548" /></a></p>
<p>Design Curate is a new platform for free and commercial resources for designers.</p>
<p>		<a class="ct-coll-link" href="http://designcurate.com/">Check it out</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Numberfy</h2>
<p>		<a class="ct-coll-thumb" href="http://www.mitya.co.uk/blog/2012/Jan/Numberfy-add-line-numbers-to-your-textareas-198"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_219.jpg" alt="Collective2_219" title="" width="200" height="99" class="alignnone size-full wp-image-7555" /></a></p>
<p>Andrew Croxall created this jQuery plugin that lets you add line numbers to textareas.</p>
<p>		<a class="ct-coll-link" href="http://www.mitya.co.uk/blog/2012/Jan/Numberfy-add-line-numbers-to-your-textareas-198">Get it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Nailing Browser Support in CSS3 and HTML5: Invaluable Resources to Use Today</h2>
<p>		<a class="ct-coll-thumb" href="http://designshack.net/articles/css/nailing-browser-support-in-css3-and-html5-invaluable-resources-to-use-today/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_220.jpg" alt="Collective2_220" title="" width="100" height="55" class="alignnone size-full wp-image-7556" /></a></p>
<p>In this article Joshua Johnson collects some great resources that help developing cross-browser compatible websites.</p>
<p>		<a class="ct-coll-link" href="http://designshack.net/articles/css/nailing-browser-support-in-css3-and-html5-invaluable-resources-to-use-today/">Read it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>Little Notepad Design (PSD)</h2>
<p>		<a class="ct-coll-thumb" href="http://www.premiumpixels.com/freebies/little-notepad-design-psd/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_221.jpg" alt="Collective2_221" title="" width="280" height="147" class="alignnone size-full wp-image-7557" /></a></p>
<p>Orman Clark shares another pixel-perfect PSD with the community: a beautiful little notepad design.</p>
<p>		<a class="ct-coll-link" href="http://www.premiumpixels.com/freebies/little-notepad-design-psd/">Get it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>deCSS3</h2>
<p>		<a class="ct-coll-thumb" href="http://davatron5000.github.com/deCSS3/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_222.jpg" alt="Collective2_222" title="" width="200" height="77" class="alignnone size-full wp-image-7558" /></a></p>
<p>deCSS3 is a bookmarklet for testing if your site degrades gracefully. Get the bookmarklet and see what your site will look like in older browsers that don&#8217;t support CSS3</p>
<p>		<a class="ct-coll-link" href="http://davatron5000.github.com/deCSS3/">Get it</a><br />
	</article>
</div>
<div class="ct-coll-item">
<article>
<h2>The separation of structure, presentation and behavior is dead</h2>
<p>		<a class="ct-coll-thumb" href="http://thinkvitamin.com/design/the-separation-of-structure-presentation-and-behavior-is-dead/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Collective2_224.jpg" alt="Collective2_224" title="" width="140" height="139" class="alignnone size-full wp-image-7559" /></a></p>
<p>Kevin Dees explains how the separation of structure, presentation and behavior is basically dead in practice and how Divergence is the new rasing pattern.</p>
<p>		<a class="ct-coll-link" href="http://thinkvitamin.com/design/the-separation-of-structure-presentation-and-behavior-is-dead/">Read it</a><br />
	</article>
</div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/collective/collective-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arctext.js &#8211; Curving Text with CSS3 and jQuery</title>
		<link>http://tympanus.net/codrops/2012/01/24/arctext-js-curving-text-with-css3-and-jquery/</link>
		<comments>http://tympanus.net/codrops/2012/01/24/arctext-js-curving-text-with-css3-and-jquery/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 15:30:03 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[curve]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=7424</guid>
		<description><![CDATA[While CSS3 allows us to rotate letters, it is quite complicated to arrange each letter along a curved path. Arctext.js is a jQuery plugin that let's you do exactly that. Based on Lettering.js, it calculates the right rotation of each letter and distributes the letters equally across the imaginary arc of the given radius.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/Arctext/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/Arctext.jpg" alt="Arctext" title="" width="580" height="315" class="alignnone size-full wp-image-7427" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/Arctext/">View demo</a> <a class="download" href="http://tympanus.net/Development/Arctext/Arctext.zip">Download source</a></p>
<p>While CSS3 allows us to rotate letters, it is quite complicated to arrange each letter along a curved path. Arctext.js is a jQuery plugin that let&#8217;s you do exactly that. Based on Lettering.js, it calculates the right rotation of each letter and distributes the letters equally across the imaginary arc of the given radius.</p>
<h3>How it works</h3>
<p>The main idea behind the Arctext plugin is to rotate letters with CSS3 transforms in order to place them along a curved path. The curve is always a segment of a circle (hence arc) for which the radius can be specified. The space and rotation for each letter will be calculated using that radius and the width of the text. </p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>Options</h3>
<p>The following options are available:</p>
<pre class="brush:js">
radius	: 0,
// the minimum value allowed is
// half of the word length.
// if set to -1, the word will be straight.

dir		: 1,
// 1: curve is down,
// -1: curve is up

rotate	: true,
// if true each letter should be rotated.

fitText	: false
// if you want to try out the
// fitText plugin (http://fittextjs.com/)
// set this to true.
// Don't forget, the wrapper should be fluid.
</pre>
<p><a class="demo" href="http://tympanus.net/Development/Arctext/">View demo</a> <a class="download" href="http://tympanus.net/Development/Arctext/Arctext.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/01/24/arctext-js-curving-text-with-css3-and-jquery/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Thumbnail Proximity Effect with jQuery and CSS3</title>
		<link>http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/</link>
		<comments>http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 12:14:25 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[proximity]]></category>
		<category><![CDATA[scale]]></category>
		<category><![CDATA[thumbnails]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=7064</guid>
		<description><![CDATA[Today we want to show you how to create a neat thumbnail proximity effect with jQuery. The idea is to scale thumbnails when hovering over them and also scale their neighbouring thumbnails proportionally to their distance. We'll also make a description appear.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/ProximityEffect/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/ProximityEffect.jpg" alt="Thumbnail Proximity Effect" title="" width="580" height="315" class="aligncenter size-full wp-image-7125" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ProximityEffect/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ProximityEffect/ProximityEffect.zip">Download source</a></p>
<p>Today we want to show you how to create a neat thumbnail proximity effect with jQuery. The idea is to scale thumbnails when hovering over them and also scale their neighbouring thumbnails proportionally to their distance. We&#8217;ll also make a description appear.</p>
<p>This is based on a request we once got from a reader who asked if the effect on <a href="http://porscheeveryday.com/">http://porscheeveryday.com/</a> could be achieved with jQuery. This is our attempt to recreate the basics of that effect.</p>
<p>We will be using the <a href="https://github.com/padolsey/jQuery-Plugins/tree/master/proximity-event">jQuery Proximity plugin</a> by <a href="http://james.padolsey.com">James Padolsey</a>. </p>
<p>The illustations in the demos are by <a href="http://www.behance.net/neo_innov">Florian Nicolle</a> and they are licensed under the <a href="http://creativecommons.org/licenses/by-nc/3.0/">Creative Commons Attribution-NonCommercial 3.0 Unported License</a>.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We&#8217;ll use an unordered list for the thumbnails and add a division for the description of each image (for this tutorial, we will be going through <a href="http://tympanus.net/Tutorials/ProximityEffect/index2.html">demo 2</a>):</p>
<pre class="brush:xml">
&lt;ul id="pe-thumbs" class="pe-thumbs"&gt;
	&lt;li&gt;
		&lt;a href="#"&gt;
			&lt;img src="images/thumbs/1.jpg" /&gt;
			&lt;div class="pe-description"&gt;
				&lt;h3&gt;Time&lt;/h3&gt;
				&lt;p&gt;Since time, and his predestinated end&lt;/p&gt;
			&lt;/div&gt;&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;!-- ... --&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Let&#8217;s style it!</p>
<h3>The CSS</h3>
<p>The unordered list will be centered on the page and we&#8217;ll add a background image to &#8220;shine through&#8221; the thumbnails that will have a low opacity:</p>
<pre class="brush:css">
.pe-thumbs{
	width: 900px;
	height: 400px;
	margin: 20px auto;
	position: relative;
	background: transparent url(../images/3.jpg) top center;
	border: 5px solid #fff;
	box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
</pre>
<p>We&#8217;ll also add a bit of tint to the background image by adding a pseudo element with a rgba background color:</p>
<pre class="brush:css">
.pe-thumbs:before {
	content: "";
	display: block;
	position: absolute;
	top: 0px;
	left: 0px;
	width: 100%;
	height: 100%;
	background: rgba(255,102,0,0.2);
}
</pre>
<p>The list items will float left and we&#8217;ll set the position of the anchors and images to relative:</p>
<pre class="brush:css">
.pe-thumbs li{
	float: left;
	position: relative;
}
.pe-thumbs li a,
.pe-thumbs li a img{
	display: block;
	position: relative;
}
</pre>
<p>Each thumbnail will have an initial width of 100 pixels and an opacity of 0.2:</p>
<pre class="brush:css">
.pe-thumbs li a img{
	width: 100px;
	opacity: 0.2;
}
</pre>
<p>The discription will be hidden by default and then we will make it appear using JavaScript:</p>
<pre class="brush:css">
.pe-thumbs li a div.pe-description{
	width: 200px;
	height: 100px;
	background: rgba(0,0,0,0.8);
	position: absolute;
	top: 0px;
	left: -200px;
	color: white;
	display: none;
	z-index: 1001;
	text-align: left;
}
</pre>
<p>And finally, let&#8217;s style the content of the description division:</p>
<pre class="brush:css">
.pe-description h3{
	padding: 10px 10px 0px 10px;
	line-height: 20px;
	font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
	font-size: 22px;
	margin: 0px;
}
.pe-description p{
	padding: 10px 0px;
	margin: 10px;
	font-size: 11px;
	font-style: italic;
	border-top: 1px solid rgba(255,255,255,0.3);
}
</pre>
<p>And that&#8217;s all the style! Let&#8217;s move on to the JavaScript!</p>
<h3>The JavaScript</h3>
<p>The main idea is to first of all calculate the description container size and position when we hover over a thumbnail. This depends of course on the maximum scale of the thumbnail and where the thumbnail is located in the main wrapper. For example, when the thumbnail is close to the right edge, we&#8217;ll want to make the description box appear on the left side of the thumbnail. </p>
<p>Then we&#8217;ll need to bind the proximity event to the images. The idea is to scale the images up or down according to the position of the mouse. Once the image scales to the maximum value, we set its z-index very high, so that it stays on top, and we show the respective description:</p>
<pre class="brush:js">
	// list of thumbs
var $list		= $('#pe-thumbs'),
	// list's width and offset left.
	// this will be used to know the position of the description container
	listW		= $list.width(),
	listL		= $list.offset().left,
	// the images
	$elems		= $list.find('img'),
	// the description containers
	$descrp		= $list.find('div.pe-description'),
	// maxScale : maximum scale value the image will have
	// minOpacity / maxOpacity : minimum (set in the CSS) and maximum values for the image's opacity
	settings	= {
		maxScale	: 1.3,
		maxOpacity	: 0.9,
		minOpacity	: Number( $elems.css('opacity') )
	},
	init		= function() {

		// minScale will be set in the CSS
		settings.minScale = _getScaleVal() || 1;
		// preload the images (thumbs)
		_loadImages( function() {

			_calcDescrp();
			_initEvents();

		});

	},
	// Get Value of CSS Scale through JavaScript:
	// http://css-tricks.com/get-value-of-css-rotation-through-javascript/
	_getScaleVal= function() {

		var st = window.getComputedStyle($elems.get(0), null),
			tr = st.getPropertyValue("-webkit-transform") ||
				 st.getPropertyValue("-moz-transform") ||
				 st.getPropertyValue("-ms-transform") ||
				 st.getPropertyValue("-o-transform") ||
				 st.getPropertyValue("transform") ||
				 "fail...";

		if( tr !== 'none' ) {	 

			var values = tr.split('(')[1].split(')')[0].split(','),
				a = values[0],
				b = values[1],
				c = values[2],
				d = values[3];

			return Math.sqrt( a * a + b * b );

		}

	},
	// calculates the style values for the description containers,
	// based on the settings variable
	_calcDescrp	= function() {

		$descrp.each( function(i) {

			var $el		= $(this),
				$img	= $el.prev(),
				img_w	= $img.width(),
				img_h	= $img.height(),
				img_n_w	= settings.maxScale * img_w,
				img_n_h	= settings.maxScale * img_h,
				space_t = ( img_n_h - img_h ) / 2,
				space_l = ( img_n_w - img_w ) / 2;

			$el.data( 'space_l', space_l ).css({
				height	: settings.maxScale * $el.height(),
				top		: -space_t,
				left	: img_n_w - space_l
			});

		});

	},
	_initEvents	= function() {

		$elems.on('proximity.Photo', { max: 80, throttle: 10, fireOutOfBounds : true }, function(event, proximity, distance) {

			var $el			= $(this),
				$li			= $el.closest('li'),
				$desc		= $el.next(),
				scaleVal	= proximity * ( settings.maxScale - settings.minScale ) + settings.minScale,
				scaleExp	= 'scale(' + scaleVal + ')';

			// change the z-index of the element once
			// it reaches the maximum scale value
			// also, show the description container
			if( scaleVal === settings.maxScale ) {

				$li.css( 'z-index', 1000 );

				if( $desc.offset().left + $desc.width() > listL + listW ) {

					$desc.css( 'left', -$desc.width() - $desc.data( 'space_l' ) );

				}

				$desc.fadeIn( 800 );

			}
			else {

				$li.css( 'z-index', 1 );

				$desc.stop(true,true).hide();

			}	

			$el.css({
				'-webkit-transform'	: scaleExp,
				'-moz-transform'	: scaleExp,
				'-o-transform'		: scaleExp,
				'-ms-transform'		: scaleExp,
				'transform'			: scaleExp,
				'opacity'			: ( proximity * ( settings.maxOpacity - settings.minOpacity ) + settings.minOpacity )
			});

		});

	},
	_loadImages	= function( callback ) {

		var loaded 	= 0,
			total	= $elems.length;

		$elems.each( function(i) {

			var $el = $(this);

			$('<img/>').load( function() {

				++loaded;
				if( loaded === total )
					callback.call();

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

		});

	};

return {
	init	: init
};
</pre>
<h3>Demos</h3>
<p>Check out all three examples:</p>
<ol>
<li><strong><a href="http://tympanus.net/Tutorials/ProximityEffect/index.html">Demo 1: Scale</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/ProximityEffect/index2.html">Demo 2: Scale with description</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/ProximityEffect/index3.html">Demo 3: Less scaling with description</a></strong></li>
</ol>
<p><a class="demo" href="http://tympanus.net/Tutorials/ProximityEffect/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ProximityEffect/ProximityEffect.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>With Rocking Letters into the New Year</title>
		<link>http://tympanus.net/codrops/2011/12/28/with-rocking-letters-into-the-new-year/</link>
		<comments>http://tympanus.net/codrops/2011/12/28/with-rocking-letters-into-the-new-year/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 17:26:27 +0000</pubDate>
		<dc:creator>Team Codrops</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[letters]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6976</guid>
		<description><![CDATA[2011 has been an exciting year for Codrops and we want to thank you for supporting us! We've learned a lot and it's a privilege to us to be able to share our tutorials, experiments and thoughts with you. We hope that you have enjoyed our content and that it was inspiring and useful to you!]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/RockingLetters/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/RockingLetters.jpg" alt="RockingLetters" width="580" height="315" class="aligncenter size-full wp-image-6988" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/RockingLetters/" >View demo</a> <a class="download" href="http://tympanus.net/Development/RockingLetters/RockingLetters.zip">Download source</a></p>
<p>2011 has been an exciting year for Codrops and we want to thank you for supporting us! We&#8217;ve learned a lot and it&#8217;s a privilege to us to be able to share our tutorials, experiments and thoughts with you. We hope that you have enjoyed our content and that it was inspiring and useful to you!</p>
<p><strong>For 2012 we have some great changes planned.</strong> We want to offer you more interesting things  in form of new categories and better interaction possibilities. This, of course, will require a new look for Codrops which means that we&#8217;ll have a major redesign coming up. Then we can all finally say &#8220;goodbye&#8221; to this blue mess :) </p>
<p>The reason why we were unable to redesign this blog until now is a very simple one: lack of time. We are trying hard to keep tutorials and articles coming and with so many new possibilities that CSS3 and HTML5 offer, we simply can&#8217;t resist to go crazy and &#8220;do something&#8221;. But we&#8217;ve set our minds to invest enough time in order to finally give Codrops a nice and functional design to reflect its purpose: <strong>giving you innovative and useful things, for free, always.</strong> </p>
<div class="yellow_box"><strong><em>If you are interested in joining us and contributing to Codrops, please <a href="mailto:info@tympanus.net" title="Write an email to us">let us know</a>, we always need creative minds.</em></strong></div>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<p>With all this in mind, we will, of course, not leave you without some inspiring experiment :) So, we want to give you some rocking letters in CSS3 for welcoming 2012 in style!</p>
<h3>How it works</h3>
<p>There are four &#8220;layers&#8221; of words that will be flying in, one after the other, making the previous one fade out. The letters will fly in rotating and get a little shake once they &#8220;smash&#8221; into their place.<br />
The demo is best viewed in a browser that supports perspective.</p>
<p><strong>Have a great 2012 and thank you for your support!</strong></p>
<p><a class="demo" href="http://tympanus.net/Development/RockingLetters/" >View demo</a> <a class="download" href="http://tympanus.net/Development/RockingLetters/RockingLetters.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/12/28/with-rocking-letters-into-the-new-year/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Experimental CSS3 Animations for Image Transitions</title>
		<link>http://tympanus.net/codrops/2011/12/19/experimental-css3-animations-for-image-transitions/</link>
		<comments>http://tympanus.net/codrops/2011/12/19/experimental-css3-animations-for-image-transitions/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 11:08:16 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6911</guid>
		<description><![CDATA[Today we want to share some experimental 3D image transitions with you that use CSS3 animations and jQuery. We'll be using CSS3 3D Transforms for Webkit only.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/ImageTransitions/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/ImageTransitions.jpg" alt="ImageTransitions" width="580" height="315" class="aligncenter size-full wp-image-6918" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/ImageTransitions/">View demo</a> <a class="download" href="http://tympanus.net/Development/ImageTransitions/ImageTransitions.zip">Download source</a></p>
<p>Today we want to share some experimental 3D image transitions with you that use CSS3 animations and jQuery. We&#8217;ll be using CSS3 3D Transforms for Webkit only. Check out the <a href="http://developer.apple.com/safaridemos/showcase/transitions/">Photo Transitions</a> at the <a href="http://developer.apple.com/safaridemos/photo-transitions.php">Safari Technology Demos site</a>, some of which we got inspired by. </p>
<p>The images used in the demo are by <a href="http://www.behance.net/qstra">Joanna Kustra</a>. </p>
<p><strong><em>Please note that the 3D effects will only work in Webkit browsers. You can view a video of how the effects look here: <a href="http://www.screenr.com/DdJs">Experimental CSS3 Animations for Image Transitions Video Demonstration</a></em></strong></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>How it works</h3>
<p>Given a set of images, we&#8217;ll add the first image to the wrapper with the class <strong>te-cover</strong>. With JavaScript we&#8217;ll control the transition classes given to the elements in the wrapper <strong>te-transition</strong> and which image will be shown. This is how the first example looks like:</p>
<pre class="brush:xml">
&lt;div id="te-wrapper" class="te-wrapper"&gt;
	&lt;div class="te-images"&gt;
		&lt;img src="images/1.jpg"/&gt;
		&lt;img src="images/2.jpg"/&gt;
		&lt;img src="images/3.jpg"/&gt;
		&lt;img src="images/4.jpg"/&gt;
		&lt;img src="images/5.jpg"/&gt;
	&lt;/div&gt;
	&lt;div class="te-cover"&gt;
		&lt;img src="images/1.jpg"/&gt;
	&lt;/div&gt;
	&lt;div class="te-transition"&gt;
		&lt;div class="te-card"&gt;
			&lt;div class="te-front"&gt;&lt;/div&gt;
			&lt;div class="te-back"&gt;&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The main idea is to always show the regarding image using <strong>te-cover</strong>. When we start an animation by giving the respective animation class, the <strong>te-cover</strong> will get hidden while the animation runs. When the animation finishes, the <strong>te-cover</strong> element will be shown again, with the updated image.</p>
<h3>Demos</h3>
<p>Each demo will have a group of possible transitions that can be selected from the dropdown menu above the image.</p>
<ol>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index.html">Demo 1: Flip</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index2.html">Demo 2: Rotate</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index3.html">Demo 3: Multi-Flip</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index4.html">Demo 4: Cube</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index5.html">Demo 5: Unfold</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index6.html">Demo 6: Others</a></strong></li>
</ol>
<p><strong>We hope you like our little experiment and find it inspiring and useful! </strong></p>
<p><a class="demo" href="http://tympanus.net/Development/ImageTransitions/" >View demo</a> <a class="download" href="http://tympanus.net/Development/ImageTransitions/ImageTransitions.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/12/19/experimental-css3-animations-for-image-transitions/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Item Blur Effect with CSS3 and jQuery</title>
		<link>http://tympanus.net/codrops/2011/12/14/item-blur-effect-with-css3-and-jquery/</link>
		<comments>http://tympanus.net/codrops/2011/12/14/item-blur-effect-with-css3-and-jquery/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 12:34:48 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[blur]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6882</guid>
		<description><![CDATA[Today we want to show you how to create a simple blur effect for text-based items. The idea is to have a set of text boxes that will get blurred and scaled down once we hover over them. The item in focus will scale up. This will create some kind of "focus" effect that drwas the attention to the currently hovered item.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/ItemBlur/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/ItemBlurEffect1.jpg" alt="ItemBlurEffect" width="580" height="315" class="aligncenter size-full wp-image-6887" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ItemBlur/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ItemBlur/ItemBlur.zip">Download source</a></p>
<p>Today we want to show you how to create a simple blur effect for text-based items. The idea is to have a set of text boxes that will get blurred and scaled down once we hover over them. The item in focus will scale up. This will create some kind of &#8220;focus&#8221; effect that drwas the attention to the currently hovered item.</p>
<p>We&#8217;ll be using CSS3 transitions and some jQuery to apply the respective classes. Since CSS3 transitions are not supported in order browsers, the demo should be best viewed in Safari or Chrome (here we got the smoothest transitions).</p>
<p><em>Since we will be using transitions, this effect will only work properly in <a href="http://www.w3schools.com/css3/css3_transitions.asp" target="_blank">browsers that support them</a>. </em></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 structure will be a section with some articles in i. Each article item will have a header and a paragraph:</p>
<pre class="brush:xml">
&lt;section class="ib-container" id="ib-container"&gt;
	&lt;article&gt;
		&lt;header&gt;
			&lt;h3&gt;&lt;a href="#"&gt;Some Headline&lt;/a&gt;&lt;/h3&gt;
			&lt;span&gt;Some other text&lt;/span&gt;
		&lt;/header&gt;
		&lt;p&gt;Some introduction&lt;/p&gt;
	&lt;/article&gt;
	&lt;article&gt;
		&lt;!-- ... --&gt;
	&lt;/article&gt;
	&lt;!-- ... --&gt;
&lt;/section&gt;
</pre>
<p>Let&#8217;s look at the style.</p>
<h3>The CSS</h3>
<p>The main container will be of fixed width and centered:</p>
<pre class="brush:css">
.ib-container{
	position: relative;
	width: 800px;
	margin: 30px auto;
}
</pre>
<p>Let&#8217;s clear the floats (out articles will be floating) <a href="http://css-tricks.com/9516-pseudo-element-roundup/" target="_blank">with the help</a> of the :before and :after pseudo elements:</p>
<pre class="brush:css">
.ib-container:before,
.ib-container:after {
    content:"";
    display:table;
}
.ib-container:after {
    clear:both;
}
</pre>
<p>Now, let&#8217;s style the article items. We&#8217;ll make them float and add two box shadows, of which the white one will have a large spread distance. Also, we&#8217;ll add the transition for three properties: opacity, transform (we want to scale it) and box-shadow:</p>
<pre class="brush:css">
.ib-container article{
	width: 140px;
	height: 220px;
	background: #fff;
	cursor: pointer;
	float: left;
	border: 10px solid #fff;
	text-align: left;
	text-transform: none;
	margin: 15px;
	z-index: 1;
	box-shadow:
		0px 0px 0px 10px rgba(255,255,255,1),
		1px 1px 3px 10px rgba(0,0,0,0.2);
	transition:
		opacity 0.4s linear,
		transform 0.4s ease-in-out,
		box-shadow 0.4s ease-in-out;
}
</pre>
<p>For Webkit browsers we&#8217;ll also add
<pre>-webkit-backface-visibility: hidden</pre>
<p> to avoid a short flicker. (You can remove this if you prefer to have a crisp looking text, though).</p>
<p>Let&#8217;s style the text elements and create some nice typography. The color and the text-shadow of each element will be matching:</p>
<pre class="brush:css">
.ib-container h3 a{
	font-size: 16px;
	font-weight: 400;
	color: rgba(0, 0, 0, 1);
	text-shadow: 0px 0px 0px rgba(0, 0, 0, 1);
	opacity: 0.8;
}
.ib-container article header span{
	font-size: 10px;
	font-family: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif;
	padding: 10px 0;
	display: block;
	color: rgba(255, 210, 82, 1);
	text-shadow: 0px 0px 0px rgba(255, 210, 82, 1);
	text-transform: uppercase;
	opacity: 0.8;
}
.ib-container article p{
	font-family: Verdana, sans-serif;
	font-size: 10px;
	line-height: 13px;
	color: rgba(51, 51, 51, 1);
	text-shadow: 0px 0px 0px rgba(51, 51, 51, 1);
	opacity: 0.8;
}
</pre>
<p>And now we&#8217;ll add the transition to all three. Again, we&#8217;ll have three properties: opacity, text-shadow and color:</p>
<pre class="brush:css">
.ib-container h3 a,
.ib-container article header span,
.ib-container article p{
	transition:
		opacity 0.2s linear,
		text-shadow 0.5s ease-in-out,
		color 0.5s ease-in-out;
}
</pre>
<p>The <strong>blur</strong> class will be applied to all the siblings of the currently hovered item. We want to scale them down a bit and add a big white box shadow, to make the box look blurry. We&#8217;ll also decrease the opacity a bit:</p>
<pre class="brush:css">
.ib-container article.blur{
	box-shadow: 0px 0px 20px 10px rgba(255,255,255,1);
	transform: scale(0.9);
	opacity: 0.7;
}
</pre>
<p>In order to make the text elements look blurry, we&#8217;ll make the color transparent by setting the opacity of the rgba value to 0, and  we&#8217;ll enlarge the text-shadow blur distance:</p>
<pre class="brush:css">
.ib-container article.blur h3 a{
	text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9);
	color: rgba(0, 0, 0, 0);
	opacity: 0.5;
}
.ib-container article.blur header span{
	text-shadow: 0px 0px 10px rgba(255, 210, 82, 0.9);
	color: rgba(255, 210, 82, 0);
	opacity: 0.5;
}
.ib-container article.blur  p{
	text-shadow: 0px 0px 10px rgba(51, 51, 51, 0.9);
	color: rgba(51, 51, 51, 0);
	opacity: 0.5;
}
</pre>
<p>The currently hovered item will be slightly enlarged and adjust the box shadow. We&#8217;ll also set a high z.index to guarantee that the item will always be on top of the other ones when we hover over it: </p>
<pre class="brush:css">
.ib-container article.active{
	transform: scale(1.05);
	box-shadow:
		0px 0px 0px 10px rgba(255,255,255,1),
		1px 11px 15px 10px rgba(0,0,0,0.4);
	z-index: 100;
	opacity: 1;
}
</pre>
<p>Last, but not least, we&#8217;ll set the opacity of the text elements to 1:</p>
<pre class="brush:css">
.ib-container article.active h3 a,
.ib-container article.active header span,
.ib-container article.active p{
	opacity; 1;
}
</pre>
<p>And that&#8217;s all the style! Let&#8217;s have a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>So, when we hover over an article, we will give all the other articles the class <strong>blur</strong> and the current one will receive the class <strong>active</strong>:</p>
<pre class="brush:js">
var $container	= $('#ib-container'),
	$articles	= $container.children('article'),
	timeout;

$articles.on( 'mouseenter', function( event ) {

	var $article	= $(this);
	clearTimeout( timeout );
	timeout = setTimeout( function() {

		if( $article.hasClass('active') ) return false;

		$articles.not($article).removeClass('active').addClass('blur');

		$article.removeClass('blur').addClass('active');

	}, 75 );

});

$container.on( 'mouseleave', function( event ) {

	clearTimeout( timeout );
	$articles.removeClass('active blur');

});
</pre>
<p>And that&#8217;s all! I hope you enjoyed this little tutorial and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ItemBlur/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ItemBlur/ItemBlur.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/12/14/item-blur-effect-with-css3-and-jquery/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Lateral On-Scroll Sliding with jQuery</title>
		<link>http://tympanus.net/codrops/2011/12/05/lateral-on-scroll-sliding-with-jquery/</link>
		<comments>http://tympanus.net/codrops/2011/12/05/lateral-on-scroll-sliding-with-jquery/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 12:02:34 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[scroll]]></category>
		<category><![CDATA[sliding]]></category>
		<category><![CDATA[timeline]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6750</guid>
		<description><![CDATA[After getting the request, we are going to show you how to create a "slide-in on scroll" effect. You've probably seen this cool effect on some websites, like on Nizo or in the portfolio section of brilliantly designed La Moulade. The main idea is to laterally slide in elements depending on the scroll position of the document. Dividing the page into a left and right side, we want to move the elements from "outside" of the page to the center when they are in the viewport. We will also add the option to move the elements in 3D space.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/LateralOnScrollSliding/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/12/LateralOnScrollSliding.jpg" alt="LateralOnScrollSliding" width="580" height="315" class="aligncenter size-full wp-image-6752" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/LateralOnScrollSliding/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/LateralOnScrollSliding/LateralOnScrollSliding.zip">Download source</a></p>
<p>After getting the request, we are going to show you how to create a &#8220;slide-in on scroll&#8221; effect. You&#8217;ve probably seen this cool effect on some websites, like on <a href="http://nizoapp.com/">Nizo</a> or in the portfolio section of brilliantly designed <a href="http://lamoulade.com/#!/projects">La Moulade</a>. The main idea is to laterally slide in elements depending on the scroll position of the document. Dividing the page into a left and right side, we want to move the elements from &#8220;outside&#8221; of the page to the center when they are in the viewport. We will also add the option to move the elements in 3D space.</p>
<p>The theme of today&#8217;s tutorial is going to be a timeline where we will have some circular elements on one side and the descriptions on the other. We&#8217;ll be alternating the sides to create a random look.</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 is going to consist of a main container and some rows that we&#8217;ll use to place the left and the right elements. The left and right elements will either contain a h2 heading, a circular link with a background image or a description in form of a h3 element with a link and a span:</p>
<pre class="brush:xml">
&lt;div id="ss-container" class="ss-container"&gt;
	&lt;div class="ss-row"&gt;
		&lt;div class="ss-left"&gt;
			&lt;h2 id="november"&gt;November&lt;/h2&gt;
		&lt;/div&gt;
		&lt;div class="ss-right"&gt;
			&lt;h2&gt;2011&lt;/h2&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class="ss-row ss-medium"&gt;
		&lt;div class="ss-left"&gt;
			&lt;a href="#" class="ss-circle ss-circle-1"&gt;Some title&lt;/a&gt;
		&lt;/div&gt;
		&lt;div class="ss-right"&gt;
			&lt;h3&gt;
				&lt;span&gt;November 28, 2011&lt;/span&gt;
				&lt;a href="#"&gt;Some Title&lt;/a&gt;
			&lt;/h3&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;!-- more rows... --&gt;
&lt;/div&gt;
</pre>
<p>For the circles we&#8217;ll have three different sizes and we&#8217;ll indicate that but giving the respective row the class of &#8220;ss-small&#8221;, &#8220;ss-medium&#8221; or &#8220;ss-large&#8221;.<br />
Let&#8217;s look at the style.</p>
<h3>The CSS</h3>
<p>The container will occupy all the width and we&#8217;ll set the overflow to hidden because we don&#8217;t want a scrollbar to appear when we move the left and right elements out of if:</p>
<pre class="brush:css">
.ss-container{
    width: 100%;
    position: relative;
    text-align: left;
    float: left;
	overflow: hidden;
	padding-bottom: 500px;
}
</pre>
<p>To create the middle line throughout the container, we&#8217;ll use a pseudo element that we&#8217;ll position in the middle of the container:</p>
<pre class="brush:css">
.ss-container:before{
    position: absolute;
    width: 4px;
    background: rgba(17,17,22,0.8);
    top: 0px;
    left: 50%;
	margin-left: -2px;
    content: '';
    height: 100%;
}
</pre>
<p>The row will serve as a wrapper for the left and right elements:</p>
<pre class="brush:css">
.ss-row{
    width: 100%;
    clear: both;
    float: left;
    position: relative;
    padding: 30px 0;
}
</pre>
<p>The two lateral elements will occupy half of the width:</p>
<pre class="brush:css">
.ss-left, .ss-right{
    float: left;
    width: 48%;
    position: relative;
}
.ss-right{
    padding-left: 2%;
}
.ss-left{
    text-align: right;
    float: left;
    padding-right: 2%;
}
</pre>
<p>The headings will have the following style:</p>
<pre class="brush:css">
.ss-container h2{
    font-size: 40px;
    text-transform: uppercase;
    color: rgba(78,84,123,0.2);
	text-shadow: 0px 1px 1px #fff;
	padding: 20px 0px;
}
.ss-container h3{
    margin-top: 34px;
	padding: 10px 15px;
	background: rgba(26, 27, 33, 0.6);
	text-shadow: 1px 1px 1px rgba(26, 27, 33, 0.8)
}
</pre>
<p>To create a circle, we&#8217;ll set the border radius of the anchor to 50% and we&#8217;ll add some neat box shadow:</p>
<pre class="brush:css">
.ss-circle{
    border-radius: 50%;
    overflow: hidden;
    display: block;
    text-indent: -9000px;
    text-align: left;
    box-shadow:
		0px 2px 5px rgba(0,0,0,0.7) inset,
		0px 0px 0px 12px rgba(61,64,85,0.3);
	background-size: cover;
	background-color: #f0f0f0;
	background-repeat: no-repeat;
	background-position: center center;
}
</pre>
<p>We&#8217;ll have three different circle sizes and depending on which side we are we&#8217;ll make the circle float either left or right:</p>
<pre class="brush:css">
.ss-small .ss-circle{
	width: 100px;
	height: 100px;
}
.ss-medium .ss-circle{
	width: 200px;
	height: 200px;
}
.ss-large .ss-circle{
	width: 300px;
	height: 300px;
}
.ss-left .ss-circle{
    float: right;
    margin-right: 30%;
}
.ss-right .ss-circle{
    float: left;
    margin-left: 30%;
}
</pre>
<p>We&#8217;ll use the pseudo element :before and :after in order to create the line and the arrow that will point to the middle line. The width will be defined as a percentage so that it adjust to the screen size. We&#8217;ll also center it by setting the top to 50% and correct the position by setting the margin-top to -3px. Depending on where we are (left or right side) we want the position to be different:</p>
<pre class="brush:css">
.ss-circle-deco:before{
	width: 29%;
	height: 0px;
	border-bottom: 5px dotted #ddd;
	border-bottom: 5px dotted rgba(17, 17, 22, 0.3);
	box-shadow: 0px 1px 1px #fff;
	position: absolute;
	top: 50%;
	content: '';
	margin-top: -3px;
}
.ss-left .ss-circle-deco:before{
    right: 2%;
}
.ss-right .ss-circle-deco:before{
    left: 2%;
}
</pre>
<p>The little arrow will be created by the border style and depending on if it&#8217;s a child of the left or right side, we&#8217;ll set the according border and position:</p>
<pre class="brush:css">
.ss-circle-deco:after{
	width: 0px;
	height: 0px;
	border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
	content: '';
	position: absolute;
	top: 50%;
	margin-top: -10px;
}
.ss-left .ss-circle-deco:after{
	right: 0;
	border-right: 10px solid rgba(17,17,22,0.8);
}
.ss-right .ss-circle-deco:after{
	left: 0;
	border-left: 10px solid rgba(17,17,22,0.8);
}
</pre>
<p>Because of the different circle sizes, we&#8217;ll need to adjust the position of the headings on the other side. We want them to be at the height of the arrow, so we&#8217;ll set the margins differently (the one for ss-small is already set in the circle itself):</p>
<pre class="brush:css">
.ss-container .ss-medium h3{
	margin-top: 82px;
}
.ss-container .ss-large h3{
	margin-top: 133px;
}
.ss-container .ss-left h3{
	border-right: 5px solid rgba(164,166,181,0.8);
}
.ss-container .ss-right h3{
	border-left: 5px solid rgba(164,166,181,0.8);
}
</pre>
<p>The style for the description:</p>
<pre class="brush:css">
.ss-container h3 span{
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    display: block;
    padding-bottom: 5px;
}
.ss-container h3 a{
    font-size: 28px;
    color: rgba(255,255,255,0.9);
    display: block;
}
.ss-container h3 a:hover{
	color: rgba(255,255,255,1);
}
</pre>
<p>Each circle is going to have a different background image:</p>
<pre class="brush:css">
.ss-circle-1{
    background-image:url(../images/1.jpg);
}
.ss-circle-2{
    background-image: url(../images/2.jpg);
}
.ss-circle-3{
    background-image: url(../images/3.jpg);
}
/* and so on... */
</pre>
<p>And that&#8217;s all the style! Let&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>The main idea is to initially show all the side elements that are visible on the viewport. All the other elements will be hidden by setting their left or right value to -50%. If the perspective option is set to true, then these elements will be translated and rotated on the y-axis, with the opacity set to 0. On scroll, we want to show the lateral elements by sliding them to position 0 (left or right, respectively), or in case of perspective, translate / rotate them accordingly once they are in the viewport. </p>
<p>Let&#8217;s start by defining some variables:</p>
<pre class="brush:js">
	// the row elements
var $rows			= $('#ss-container > div.ss-row'),
	// we will cache the inviewport
	// rows and the outside viewport rows
	$rowsViewport, $rowsOutViewport,
	// navigation menu links
	$links			= $('#ss-links > a'),
	// the window element
	$win			= $(window),
	// we will store the window sizes here
	winSize			= {},
	// used in the scroll setTimeout function
	anim			= false,
	// page scroll speed
	scollPageSpeed	= 2000 ,
	// page scroll easing
	scollPageEasing = 'easeInOutExpo',
    // perspective?
    hasPerspective	= true,
    perspective	= hasPerspective &#038;&#038; Modernizr.csstransforms3d,
</pre>
<p>We&#8217;ll have the following functions:</p>
<pre class="brush:js">
// initialize function
init			= function() {
	// get window sizes
	getWinSize();
	// initialize events
	initEvents();
	// define the inviewport selector
	defineViewport();
	// gets the elements that match the previous selector
	setViewportRows();
	// if perspective add css
	if( perspective ) {
		$rows.css({
			'-webkit-perspective'		: 600,
			'-webkit-perspective-origin'	: '50% 0%'
		});
	}
	// show the pointers for the inviewport rows
	$rowsViewport.find('a.ss-circle').addClass('ss-circle-deco');
	// set positions for each row
	placeRows();
},
</pre>
<p><strong>defineViewport</strong> defines a selector that gathers the row elements that are initially visible. An element is visible if its top is less than the window&#8217;s height. These elements will not be affected when scrolling the page:</p>
<pre class="brush:js">
defineViewport	= function() {

	$.extend( $.expr[':'], {

		inviewport	: function ( el ) {
			if ( $(el).offset().top < winSize.height ) {
				return true;
			}
			return false;
		}

	});

},
</pre>
<p><strong>setViewportRows</strong> checks which rows are initially visible:</p>
<pre class="brush:js">
setViewportRows	= function() {

	$rowsViewport 		= $rows.filter(':inviewport');
	$rowsOutViewport	= $rows.not( $rowsViewport )

},
</pre>
<p><strong>getWinSize</strong> gets the window width and height:</p>
<pre class="brush:js">
getWinSize		= function() {

	winSize.width	= $win.width();
	winSize.height	= $win.height();

},
</pre>
<p>And now let's initialize some events:</p>
<pre class="brush:js">
	initEvents		= function() {

		// navigation menu links.
		// scroll to the respective section.
		$links.on( 'click.Scrolling', function( event ) {

			// scroll to the element that has id = menu's href
			$('html, body').stop().animate({
				scrollTop: $( $(this).attr('href') ).offset().top
			}, scollPageSpeed, scollPageEasing );

			return false;

		});

		$(window).on({
			// on window resize we need to redefine
			// which rows are initially visible
			// (this ones we will not animate).
			'resize.Scrolling' : function( event ) {

				// get the window sizes again
				getWinSize();
				// redefine which rows are initially
				// visible (:inviewport)
				setViewportRows();
				// remove pointers for every row
				$rows.find('a.ss-circle').removeClass('ss-circle-deco');
				// show inviewport rows and respective pointers
				$rowsViewport.each( function() {

					$(this).find('div.ss-left')
						   .css({ left   : '0%' })
						   .end()
						   .find('div.ss-right')
						   .css({ right  : '0%' })
						   .end()
						   .find('a.ss-circle')
						   .addClass('ss-circle-deco');

				});

			},
			// when scrolling the page change
			// the position of each row
			'scroll.Scrolling' : function( event ) {

				// set a timeout to avoid that the
				// placeRows function gets called on
				// every scroll trigger
				if( anim ) return false;
				anim = true;
				setTimeout( function() {

					placeRows();
					anim = false;

				}, 10 );

			}
		});

	},
</pre>
<p><strong>placeRows</strong> sets the position of the rows (left and right row elements). Both of these elements will start with -50% for the left/right (not visible). This value should be 0% (final position) when the element is in the center of the window.</p>
<pre class="brush:js">
placeRows		= function() {
		// how much we scrolled so far
	var winscroll	= $win.scrollTop(),
		// the y value for the center of the screen
	winCenter	= winSize.height / 2 + winscroll;

	// for every row that is not inviewport
	$rowsOutViewport.each( function(i) {

		var $row	= $(this),
			// the left side element
			$rowL	= $row.find('div.ss-left'),
			// the right side element
			$rowR	= $row.find('div.ss-right'),
			// top value
			rowT	= $row.offset().top;

		// hide the row if it is under the viewport
		if( rowT > winSize.height + winscroll ) {

			if( perspective ) {

				$rowL.css({
					'-webkit-transform'	: 'translate3d(-75%, 0, 0) rotateY(-90deg) translate3d(-75%, 0, 0)',
					'opacity'			: 0
				});
				$rowR.css({
					'-webkit-transform'	: 'translate3d(75%, 0, 0) rotateY(90deg) translate3d(75%, 0, 0)',
					'opacity'			: 0
				});

			}
			else {

				$rowL.css({ left 		: '-50%' });
				$rowR.css({ right 		: '-50%' });

			}

		}
		// if not, the row should become visible
		// (0% of left/right) as it gets closer to
		// the center of the screen.
		else {

				// row's height
			var rowH	= $row.height(),
				// the value on each scrolling step
				// will be proporcional to the distance
				// from the center of the screen to its height
				factor 	= ( ( ( rowT + rowH / 2 ) - winCenter ) / ( winSize.height / 2 + rowH / 2 ) ),
				// value for the left / right of each side of the row.
				// 0% is the limit
				val		= Math.max( factor * 50, 0 );

			if( val <= 0 ) {

				// when 0% is reached show the pointer for that row
				if( !$row.data('pointer') ) {

					$row.data( 'pointer', true );
					$row.find('.ss-circle').addClass('ss-circle-deco');

				}

			}
			else {

				// the pointer should not be shown
				if( $row.data('pointer') ) {

					$row.data( 'pointer', false );
					$row.find('.ss-circle').removeClass('ss-circle-deco');

				}

			}

			// set calculated values
			if( perspective ) {

				var	t = Math.max( factor * 75, 0 ),
					r = Math.max( factor * 90, 0 ),
					o = Math.min( Math.abs( factor - 1 ), 1 );

				$rowL.css({
					'-webkit-transform'	: 'translate3d(-' + t + '%, 0, 0) rotateY(-' + r + 'deg) translate3d(-' + t + '%, 0, 0)',
					'opacity'           : o
				});
				$rowR.css({
					'-webkit-transform'	: 'translate3d(' + t + '%, 0, 0) rotateY(' + r + 'deg) translate3d(' + t + '%, 0, 0)',
					'opacity'		: o
				});

			}
			else {

				$rowL.css({ left 	: - val + '%' });
				$rowR.css({ right 	: - val + '%' });

			}

		}	

	});

};

return { init : init };
</pre>
<h3>Demos</h3>
<p>Check out the two demos, one with the "normal" slide in and one with the 3D sliding:</p>
<ul>
<li><a href="http://tympanus.net/Tutorials/LateralOnScrollSliding/" target="_blank">Default demo</a></li>
<li><a href="http://tympanus.net/Tutorials/LateralOnScrollSliding/index2.html" target="_blank">Perspective Demo (Webkit only)</a></li>
</ul>
<p>And that's it! I hope you enjoyed this tutorial and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/LateralOnScrollSliding/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/LateralOnScrollSliding/LateralOnScrollSliding.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/12/05/lateral-on-scroll-sliding-with-jquery/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Typography Effects with CSS3 and jQuery</title>
		<link>http://tympanus.net/codrops/2011/11/28/typography-effects-with-css3-and-jquery/</link>
		<comments>http://tympanus.net/codrops/2011/11/28/typography-effects-with-css3-and-jquery/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 18:01:24 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6660</guid>
		<description><![CDATA[Today we will create a set of nice typography effects for big headlines using CSS3 and jQuery. There are many things we can do with CSS3 animations and transitions and we'll explore some of the possibilites.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/TypographyEffects/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffects.jpg" alt="TypographyEffects" width="580" height="315" class="aligncenter size-full wp-image-6672" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/TypographyEffects/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/TypographyEffects/TypographyEffects.zip">Download source</a> </p>
<p>Today we will create a set of nice typography effects for big headlines using CSS3 and jQuery. There are many things we can do with CSS3 animations and transitions and we&#8217;ll explore some of the possibilites.</p>
<p>We&#8217;ll be using <a href="http://letteringjs.com/" target="_blank">Lettering.js</a> in order to style single letters of the words we&#8217;ll be having in our big headlines.</p>
<p>The image used in the demo is by <a href="http://www.behance.net/AndrewLili">Andrey &#038; Lili</a>. They are licensed under the <a title="Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)" href="http://creativecommons.org/licenses/by-nc/3.0/" target="_blank">Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) License</a>. </p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The HTML</h3>
<p>The structure will simply be an h2 element with an anchor inside. We&#8217;ll wrap the headline in a container:</p>
<pre class="brush:xml">
&lt;div id="letter-container" class="letter-container"&gt;
	&lt;h2&gt;&lt;a href="#"&gt;Sun&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
</pre>
<p>Then we&#8217;ll call the Lettering.js plugin, so that every letter gets wrapped in a span. </p>
<p>Now, let&#8217;s take a look at each example. I&#8217;ll show all the styles that are relevant to the effect. In the downloadable files, you can check out all the other styles, like the positioning of the headline, the fonts and so on.</p>
<p>In order not to bloat the tutorial, I will not be showing any CSS vendor prefixes. The downloadable files contain them, of course. </p>
<h4>Example 1</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_1.jpg" alt="TypographyEffect_1" width="580" height="201" class="aligncenter size-full wp-image-6662" /></a><br />
In the first example we want to skew the letters in order to create bit of perspective. But we also want to change the word on hover, so our structure will contain an additional link element inside of the h2. For the effect to work nicely, we&#8217;ll choose two words with the same number of letters:</p>
<pre class="brush:xml">
&lt;div id="letter-container" class="letter-container"&gt;
	&lt;h2&gt;&lt;a href="#"&gt;Chaos&lt;/a&gt;&lt;/h2&gt;
	&lt;h2&gt;&lt;a href="#"&gt;Order&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
</pre>
<p>We&#8217;ll give the link element an absolute position and make the second word disappear by giving it the opacity 0:</p>
<pre class="brush:css">
.letter-container h2 a{
	text-align: center;
	text-transform: uppercase;
	font-size: 150px;
	position: absolute;
	width: 800px;
	height: 180px;
	top: 0px;
	left: 50%;
	margin-left: -400px;
	transition: all 0.3s linear;
}
.letter-container h2 a:nth-child(2){
	opacity: 0;
}
</pre>
<p>The spans will have some characteristic text shadow and a transition. The even children of will be skewed 10 degrees and the odd ones -10 degrees:</p>
<pre class="brush:css">
.letter-container h2 a span{
	display: inline-block;
	position: relative;
	width: 120px;
	margin: 0px;
	transition: all 0.3s linear;
	text-shadow:
		2px 2px 2px rgba(0,0,0,0.6),
		1px 1px 2px rgba(0,0,0,0.4),
		0px 0px 2px rgba(255,255,255,0.9);
}
.letter-container h2 a span:nth-child(odd){
	transform: skewY(10deg);
	background: #333;
	box-shadow: 0px 3px 5px rgba(0,0,0,0.3);
	z-index: 10;
}
.letter-container h2 a span:nth-child(even){
	transform: skewY(-10deg);
	background: #666;
	box-shadow: 0px 3px 5px rgba(0,0,0,0.3);
	z-index: 10;
}
</pre>
<p>When we hover over the h2 element, we want the second link element to appear and the first to disappear: </p>
<pre class="brush:css">
.letter-container h2:hover a:nth-child(1){
	opacity: 0;
}
.letter-container h2:hover a:nth-child(2){
	opacity: 1;
}
</pre>
<p>Also, we want to straighten the letters out:</p>
<pre class="brush:css">
.letter-container h2:hover a span{
	transform: skewY(0deg);
	background: #680121;
}
.letter-container h2 a span:hover{
	color: #f6b0c5;
}
</pre>
<h4>Example 2</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index2.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_2.jpg" alt="TypographyEffect_2" width="580" height="128" class="aligncenter size-full wp-image-6663" /></a></p>
<p>In the second example we&#8217;ll play a bit with pseudo elements. First, we&#8217;ll style each span in a way to look like a polaroid:</p>
<pre class="brush:css">
.letter-container h2 a span{
	display: inline-block;
	position: relative;
	width: 200px;
	height: 140px;
	background: #000;
	line-height: 140px;
	font-size: 120px;
	margin: 3px;
	background-position: 50% 0%;
	background-size: 200px 267px;
	color: #fff;
	text-shadow:
		0px 0px 1px #fff,
		2px 2px 5px rgba(0,0,0,0.4);
	border-color: #fff;
	border-style: solid;
	border-width: 10px 10px 45px 10px;
	box-shadow:
		2px 2px 8px 4px rgba(0,0,0,0.9),
		0px 0px 2px rgba(0,0,0,0.2) inset;
	transition: all 0.3s ease-in-out;
}
</pre>
<p>We&#8217;ll then add a pseudo element that will contain a wicked gradient, making our polaroid look more real:</p>
<pre class="brush:css">
.letter-container h2 a span:before{
	content:'';
	position: absolute;
	width: 220px;
	height: 195px;
	top: -10px;
	left: -10px;
	background: linear-gradient(-45deg, rgba(14,14,14,0.32) 0%,rgba(127,127,127,0.21) 18%,rgba(170,170,170,0.11) 34%,rgba(201,201,201,0) 51%,rgba(242,242,242,0.1) 66%,rgba(255,255,255,0.18) 79%,rgba(71,69,69,0.32) 100%);
}
</pre>
<p>Now, we&#8217;ll rotate the odd and even children differently to create a random look:</p>
<pre class="brush:css">
.letter-container h2 a span:nth-child(even){
	transform: rotate(3deg);
}
.letter-container h2 a span:nth-child(odd){
	transform: rotate(-5deg);
}
</pre>
<p>For each character (we are using the classes applied by lettering.js but we could also use the nth-child selector) we will add a different background image:</p>
<pre class="brush:css">
.letter-container span.char1{
	background-image: url(../images/1.jpg);
}
.letter-container span.char2{
	background-image: url(../images/2.jpg);
}
.letter-container span.char3{
	background-image: url(../images/3.jpg);
}
.letter-container span.char4{
	background-image: url(../images/4.jpg);
}
.letter-container span.char5{
	background-image: url(../images/5.jpg);
}
</pre>
<p>On hover over the whole link, we will rotate the spans and scale them down:</p>
<pre class="brush:css">
.letter-container h2 a:hover span:nth-child(even){
	transform: scale(0.9) rotate(-5deg);
}
.letter-container h2 a:hover span:nth-child(odd){
	transform: scale(0.9) rotate(3deg);
}
</pre>
<p>The specific span that we are hovering will have an animation that makes the background image move:</p>
<pre class="brush:css">
.letter-container h2 a span:nth-child(even):hover,
.letter-container h2 a span:nth-child(odd):hover{
	animation: moveImg 9s linear infinite forwards;
	color: rgba(255,255,255,0.4);
	text-shadow:0px 0px 5px rgba(0,0,0,0.1);
	transform: scale(1.1);
	z-index: 10;
	box-shadow:
		2px 2px 20px 4px rgba(0,0,0,0.6),
		0px 0px 2px rgba(0,0,0,0.2) inset;
}
@keyframes moveImg {
    0%{
		background-position: 50% 0%;
	}
	50%{
		background-position: 50% 100%;
	}
	100%{
		background-position: 50% 0%;
	}
}
</pre>
<h4>Example 3</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index3.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_3.jpg" alt="TypographyEffect_3" width="580" height="224" class="aligncenter size-full wp-image-6664" /></a></p>
<p>In the third example we will apply an animation to the span class which will run once when the page is loaded. We will make a blurry letter become sharp. We will also use a mask to add some texture to the letters (only Webkit browsers currently):</p>
<pre class="brush:css">
.letter-container h2 a span {
	font-size: 105px;
	color: #444;
   	opacity: 1;
   	text-shadow: 0px 0px 2px #444, 1px 1px 4px rgba(0,0,0,0.7);
	mask-image: url(../images/mask2.png);
	transition: all 0.3s linear;
	animation: sharpen 0.6s linear backwards;
}
</pre>
<p>When hovering over a letter we&#8217;ll change its color:</p>
<pre class="brush:css">
.letter-container h2 a span:hover{
	color: #3f7f75;
}
</pre>
<p>We&#8217;ll create some random appearence of the letters by giving each letter an animation delay:</p>
<pre class="brush:css">
.letter-container h2 a span:nth-child(1) {
	animation-delay: 1.2s;
}
.letter-container h2 a span:nth-child(2) {
	animation-delay: 0.1s;
}
.letter-container h2 a span:nth-child(3) {
	animation-delay: 1s;
}
/* ... and so on for all the letters */
</pre>
<p>The animation makes the letter appear blurry with a text-shadow with high fuzziness and a transparent color. Then it will appear sharpened by turning into a letter with solid color and a subtle text shadow:</p>
<pre class="brush:css">
@keyframes sharpen {
 0% {
   	opacity: 0;
   	text-shadow: 0px 0px 100px #444;
   	color: transparent;
 }
 90% {
   	opacity: 0.9;
   	text-shadow: 0px 0px 10px #444;
   	color: transparent;
 }
 100% {
    color: #444;
   	opacity: 1;
   	text-shadow: 0px 0px 2px #444, 1px 1px 4px rgba(0,0,0,0.7);
 }
}
</pre>
<h4>Example 4</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index4.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_4.jpg" alt="TypographyEffect_4" width="580" height="173" class="aligncenter size-full wp-image-6665" /></a><br />
This example is quite different from all the others because we will apply some more jQuery. To understand what we are doing, I will show you what our jQuery function is making out of the headline. The structure that is created for each letter span after we apply lettering.js is the following:</p>
<pre class="brush:xml">
&lt;div class="twrap"&gt;
	&lt;div class="tbg"&gt;&lt;span&gt;P&lt;/span&gt;&lt;/div&gt;
	&lt;div class="tup"&gt;
		&lt;div class="tfront"&gt;&lt;span&gt;P&lt;/span&gt;&lt;/div&gt;
		&lt;div class="tback"&gt;&lt;span&gt;P&lt;/span&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class="tdown"&gt;&lt;span&gt;P&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Now, why such a structure? We want to play with perspective and 3d transforms, so we need a few more elements to make this work.<br />
We want this headline to look like an airport information board and when we hover over a span, we want the little top element to fall down, but in 3D! This will only work in a Webkit browser, but we will have a nice alternative for the others.</p>
<p>So, let&#8217;s start by styting that new wrapper. It will be the container with the persepctive:</p>
<pre class="brush:css">
.letter-container h2 .twrap{
	position: relative;
	display: inline-block;
	width: 100px;
	height: 120px;
	line-height: 120px;
	font-size: 120px;
	border: 15px solid rgba(0,0,0,0.5);
	-webkit-perspective: 400;
	box-shadow: 1px 1px 4px #000;
}
</pre>
<p>Then we&#8217;ll style the background letter, which will be yellow:</p>
<pre class="brush:css">
.letter-container h2 .tbg{
	background: #121212;
	position: absolute;
	color: #f2c200;
	width: 100%;
	height: 100%;
	box-shadow: 0px 1px 3px rgba(0,0,0,0.9);
}
</pre>
<p>The down part of the letter in both the &#8220;tdown&#8221; and the &#8220;tup&#8221; (&#8220;tback&#8221;) container will be pulled up with a negative margin, because we just want to show the lower part:</p>
<pre class="brush:css">
.letter-container h2 .tdown{
	height: 50%;
	top: 50%;
	width: 100%;
	position: absolute;
	overflow: hidden;
	z-index: 1;
	background: #151515;
	box-shadow: 0px 1px 3px rgba(0,0,0,0.9);
	transition: all 0.3s linear;
}
.letter-container h2 .tdown span,
.letter-container h2 .tup .tback span{
	display: block;
	margin-top:-60px;
}
</pre>
<p>All the elements will have an aboslute position. The elements inside of &#8220;tup&#8221; will have -webkit-backface-visibility: hidden. Like that we&#8217;ll be able to rotate &#8220;tback&#8221; in 3d space and then &#8220;tup&#8221; when we hover:</p>
<pre class="brush:css">
.letter-container h2 .tup{
	height: 50%;
	width: 100%;
	position: absolute;
	z-index: 10;
	-webkit-transform-origin: 50% 100%;
	transition: all 0.3s linear;
	box-shadow: 0px 1px 3px rgba(0,0,0,0.9);
}
.letter-container h2 .tup .tfront,
.letter-container h2 .tup .tback{
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0px;
	overflow: hidden;
	-webkit-backface-visibility: hidden;
	background: #151515;
}
.letter-container h2 .tup .tback{
	background: #121212;
	color: #f2c200;
}
.csstransforms3d .letter-container h2 .tup .tback{
	-webkit-transform: rotateX(-180deg);
}
.csstransforms3d .letter-container h2 a .twrap:hover .tup{
	-webkit-transform: rotateX(-180deg);
}
</pre>
<p>When we dont&#8217; have support for the 3d transform then we&#8217;ll not show &#8220;tback&#8221;. We&#8217;ll instead animate &#8220;tup&#8221; and &#8220;tdown&#8221; to move to the back:</p>
<pre class="brush:css">
/* For browsers with no 3d transfrom support */
.no-csstransforms3d .letter-container h2 .tup .tback{
	display: none;
}
.no-csstransforms3d .letter-container h2 a .twrap:hover .tup{
	animation: moveBackUp 0.7s ease-in-out forwards;
}
.no-csstransforms3d .letter-container h2 a .twrap:hover .tdown{
	animation: moveBackDown 0.7s ease-in-out forwards;
}
@keyframes moveBackUp {
    0%{
		transform: translateY(0%);
	}
	50%{
		transform: translateY(-120%);
		z-index: -1;
	}
	100%{
		transform: translateY(0%);
		z-index: -1;
	}
}
@keyframes moveBackDown {
    0%{
		transform: translateY(0%);
	}
	50%{
		transform: translateY(120%);
		z-index: -1;
	}
	100%{
		transform: translateY(0%);
		z-index: -1;
	}
}
</pre>
<h4>Example 5</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index5.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_5.jpg" alt="TypographyEffect_5" width="580" height="220" class="aligncenter size-full wp-image-6666" /></a><br />
Ok, example 5 looks crazy: we&#8217;ll create a text shadow that &#8220;elevates&#8221; the letters. We&#8217;ll also create a pseudo element which has a superhero as background:</p>
<pre class="brush:css">
.letter-container h2 a:before{
	content: '';
	position: absolute;
	z-index: 0;
	width: 525px;
	height: 616px;
	background: transparent url(../images/superhero.png) no-repeat center center;
	background-size: 40%;
	top: 0px;
	left: 50%;
	margin-left: -277px;
	transition: all 0.3s ease-in-out;
}
</pre>
<p>On hover, we will animate the background size to make the superhero larger:</p>
<pre class="brush:css">
.letter-container h2 a:hover:before{
	background-size: 100%;
}
</pre>
<p>The span will have the text-shadow that &#8220;elevates&#8221; the letters and on hover, we will move the letter down by adding a padding and changing the shadow:</p>
<pre class="brush:css">
.letter-container h2 a span{
	color: #ff3de6;
	float:left;
	position: relative;
	z-index: 100;
	transition: all 0.3s ease-in-out;
	text-shadow:
	  0px -1px 3px #cb4aba,
	  0 4px 3px #934589,
	  2px 15px 5px rgba(0, 0, 0, 0.2),
	  1px 20px 10px rgba(0, 0, 0, 0.3);
}
.letter-container h2 a span:hover{
	color: #e929d0;
	padding-top: 10px;
	text-shadow:
	  0px -1px 3px #cb4aba,
	  0 4px 3px #934589,
	  1px 1px 10px rgba(0, 0, 0, 0.2);
}
</pre>
<h4>Example 6</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index6.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_6.jpg" alt="TypographyEffect_6" width="580" height="208" class="aligncenter size-full wp-image-6667" /></a><br />
In this example we&#8217;ll do something similar like in demo 3, except that we&#8217;ll animate the letters in order.<br />
We&#8217;ll also apply a mask that will give some texture to the letters:</p>
<pre class="brush:css">
.letter-container h2 a {
	text-align: center;
	font-size: 130px;
	line-height: 160px;
	display: block;
	padding-bottom: 30px;
	mask: url(../images/mask.png) repeat;
}
</pre>
<p>The animation will sharpen the letters and we will apply a different animation delay to each child:</p>
<pre class="brush:css">
.letter-container h2 a span {
	color: #fff;
   	opacity: 1;
   	text-shadow: 0px 0px 2px #fff, 1px 1px 4px rgba(0,0,0,0.7);
	transition: all 0.3s linear;
	animation: sharpen 0.9s linear backwards;
}
.letter-container h2 a span:hover{
	text-shadow: 0px 0px 40px #fff;
}
.letter-container h2 a span:nth-child(1) {
	animation-delay: 0s;
}
.letter-container h2 a span:nth-child(2) {
	animation-delay: 0.1s;
}
.letter-container h2 a span:nth-child(3) {
	animation-delay: 0.2s;
}
/* ...and so on for all the letters */

@keyframes sharpen {
 0% {
   	opacity: 0;
   	text-shadow: 0px 0px 100px #fff;
   	color: transparent;
 }
 90% {
   	opacity: 0.9;
   	text-shadow: 0px 0px 10px #fff;
   	color: transparent;
 }
 100% {
    color: #fff;
   	opacity: 1;
   	text-shadow: 0px 0px 2px #fff, 1px 1px 4px rgba(0,0,0,0.7);
 }
}
</pre>
<h4>Example 7</h4>
<p><a href="http://tympanus.net/Tutorials/TypographyEffects/index7.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/TypographyEffect_7.jpg" alt="TypographyEffect_7" width="580" height="227" class="aligncenter size-full wp-image-6668" /></a><br />
In the last example we&#8217;ll create some circles for each letter and on hover we will add a radial gradient to make it appear as a sun:</p>
<pre class="brush:css">
.letter-container h2 a span{
	display: inline-block;
	background: #bfd4e2;
	color: #ecf0f2;
	text-shadow: 1px 1px 2px rgba(120,155,179,0.5);
	width: 200px;
	height: 200px;
	line-height: 200px;
	font-size: 100px;
	margin: 3px;
	cursor: pointer;
	border-radius: 50%;
	box-shadow:
		2px 2px 10px rgba(43,54,61, 0.4),
		0px 0px 0px 9px rgba(116,161,191,0.3) inset;
	transition: all 0.3s ease-in-out;
}
.letter-container h2 a:hover span{
	opacity: 0.3;
}
</pre>
<p>You can read a great explanation of the radial gradient here: <a href="http://www.impressivewebs.com/css3-radial-gradient-syntax/">CSS3 Radial Gradient Syntax Breakdown &#8211; Impressive Webs</a></p>
<pre class="brush:css">
.letter-container h2 a span:hover{
	opacity: 1;
	box-shadow:
		2px 2px 10px rgba(43,54,61, 0.4),
		0px 0px 0px 0px #fedc3f inset,
		0px 0px 100px 30px rgba(255,244,193,0.8);
	color: #ff8624;
	text-shadow:
		1px 1px 2px rgba(166,97,41,0.5),
		1px 1px 1px #e66212, 3px 3px 1px #fdff64,
		4px 4px 6px #ff7420;
	background-image:
		radial-gradient(
			center center,
			circle contain,
			#fedc3f 0%, #ff7420 100%
			);
}
</pre>
<p>And that&#8217;s it! I hope you enjoyed creating some crazy typography effects with CSS3 and jQuery!<br />
What&#8217;s your favorite one?</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/TypographyEffects/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/TypographyEffects/TypographyEffects.zip">Download source</a> </p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/11/28/typography-effects-with-css3-and-jquery/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Hover and Click Trigger for Circular Elements with jQuery</title>
		<link>http://tympanus.net/codrops/2011/11/22/hover-and-click-trigger-circular-elements/</link>
		<comments>http://tympanus.net/codrops/2011/11/22/hover-and-click-trigger-circular-elements/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 11:55:16 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6504</guid>
		<description><![CDATA[Today we want to share one possible solution to the circle hovering problem. We'll create a plugin that will take care of the 'mouseenter', 'mouseleave' and 'click' events to be triggered only on the circular shape of the element and not its bounding box.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/HoverClickTriggerCircle/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/HoverClickTriggerCircles.jpg" alt="HoverClickTriggerCircles" width="580" height="315" class="aligncenter size-full wp-image-6533" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/HoverClickTriggerCircle/" >View demo</a> <a class="download" href="http://tympanus.net/Development/HoverClickTriggerCircle/HoverClickTriggerCircle.zip">Download source</a></p>
<p>Applying a :hover pseudo-class to an element is widely known as the classic &#8220;hovering&#8221; over an element on a web page. A problem that arose with the introduction of the border-radius property is the non-realistic triggering of the hover event when entering the bounding box of the element and not just the actual visible area. This becomes extreme when we create a circle by setting the border-radius of a square to 50% (half of its outer width and height). </p>
<p>Today we want to share one possible solution to the circle hovering problem. We&#8217;ll create a plugin that will take care of the &#8216;mouseenter&#8217;, &#8216;mouseleave&#8217; and &#8216;click&#8217; events to be triggered only on the circular shape of the element and not its bounding box.</p>
<p>The image used in the demo is by <a href="http://www.behance.net/AndrewLili">Andrey &#038; Lili</a>. They are licensed under the <a title="Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)" href="http://creativecommons.org/licenses/by-nc/3.0/" target="_blank">Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) License</a>. </p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>How it works</h3>
<p>In our example, we&#8217;ll be creating a circle with some kind of hover effect. The structure will simply be:</p>
<pre class="brush:xml">
&lt;a href="#" id="circle" class="ec-circle"&gt;
	&lt;h3&gt;Hovered&lt;/h3&gt;
&lt;/a&gt;
</pre>
<p>And the style will be the following:</p>
<pre class="brush:css">
.ec-circle{
	width: 420px;
	height: 420px;
	-webkit-border-radius: 210px;
	-moz-border-radius: 210px;
	border-radius: 50%;
	text-align: center;
	overflow: hidden;
	font-family:'Kelly Slab', Georgia, serif;
	background: #dda994 url(../images/1.jpg) no-repeat center center;
	box-shadow:
		inset 0 0 1px 230px rgba(0,0,0,0.6),
		inset 0 0 0 7px #d5ad94;
	transition: box-shadow 400ms ease-in-out;
	display: block;
	outline: none;
}
</pre>
<p>Now, we will define a class for the hover effect but <strong>not</strong> a dynamic pseudo-class :hover. The idea is to apply this class then with jQuery when we enter the circular area of our element:</p>
<pre class="brush:css">
.ec-circle-hover{
    box-shadow:
		inset 0 0 0 0 rgba(0,0,0,0.6),
		inset 0 0 0 20px #c18167,
		0 0 10px rgba(0,0,0,0.3);
}
</pre>
<p>Only when we have JavaScript disabled, we&#8217;ll add the pseudo-class. This style can be found in the <i>noscript.css</i>:</p>
<pre class="brush:css">
.ec-circle:hover{
    box-shadow:
		inset 0 0 0 0 rgba(0,0,0,0.6),
		inset 0 0 0 20px #c18167,
		0 0 10px rgba(0,0,0,0.3);
}
</pre>
<h3>The JavaScript</h3>
<p>We are going to create a simple plugin that basically &#8220;redefines&#8221; the three events mentioned earlier. We&#8217;ll make the events only applicable on the circular shape:</p>
<pre class="brush:js">
$.CircleEventManager 			= function( options, element ) {

	this.$el			= $( element );

	this._init( options );

};

$.CircleEventManager.defaults 	= {
	onMouseEnter	: function() { return false },
	onMouseLeave	: function() { return false },
	onClick			: function() { return false }
};

$.CircleEventManager.prototype 	= {
	_init 				: function( options ) {

		this.options 		= $.extend( true, {}, $.CircleEventManager.defaults, options );

		// set the default cursor on the element
		this.$el.css( 'cursor', 'default' );

		this._initEvents();

	},
	_initEvents			: function() {

		var _self	= this;

		this.$el.on({
			'mouseenter.circlemouse'	: function( event ) {

				var el	= $(event.target),

						  circleWidth	= el.outerWidth( true ),
						  circleHeight	= el.outerHeight( true ),
						  circleLeft	= el.offset().left,
						  circleTop		= el.offset().top,
						  circlePos		= {
							  x		: circleLeft + circleWidth / 2,
							  y		: circleTop + circleHeight / 2,
							  radius: circleWidth / 2
						  };

				// save cursor type
				var cursor	= 'default';

				if( _self.$el.css('cursor') === 'pointer' || _self.$el.is('a') )
					cursor = 'pointer';

				el.data( 'cursor', cursor );

				el.on( 'mousemove.circlemouse', function( event ) {

					var distance	= Math.sqrt( Math.pow( event.pageX - circlePos.x, 2 ) + Math.pow( event.pageY - circlePos.y, 2 ) );

					if( !Modernizr.borderradius ) {

						// inside element / circle
						el.css( 'cursor', el.data('cursor') ).data( 'inside', true );
						_self.options.onMouseEnter( _self.$el );

					}
					else {

						if( distance <= circlePos.radius &#038;&#038; !el.data('inside') ) {

							// inside element / circle
							el.css( 'cursor', el.data('cursor') ).data( 'inside', true );
							_self.options.onMouseEnter( _self.$el );

						}
						else if( distance > circlePos.radius &#038;&#038; el.data('inside') ) {

							// inside element / outside circle
							el.css( 'cursor', 'default' ).data( 'inside', false );
							_self.options.onMouseLeave( _self.$el );

						}

					}

				});	

			},
			'mouseleave.circlemouse'	: function( event ) {

				var el 	= $(event.target);

				el.off('mousemove');

				if( el.data( 'inside' ) ) {

					el.data( 'inside', false );
					_self.options.onMouseLeave( _self.$el );

				}

			},
			'click.circlemouse'			: function( event ) {

				// allow the click only when inside the circle

				var el 	= $(event.target);

				if( !el.data( 'inside' ) )
					return false;
				else
					_self.options.onClick( _self.$el );

			}
		});

	},
	destroy				: function() {

		this.$el.unbind('.circlemouse').removeData('inside').removeData('cursor');

	}
};
</pre>
<p>When we enter with the mouse in the square bounding box of our circle, we bind the &#8216;mousemove&#8217; event to the element and like that we can track if the distance of the mouse to the center of the element if longer than  the radius. If it is, we know that we are not yet hovering the circular area of the element. </p>
<p><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/hoverTrigger.jpg" alt="HoverTrigger"  width="580" height="283" class="aligncenter size-full wp-image-6508" /><br />
Once the distance of the mouse is shorter than the radius, we know that we entered the circle and we trigger our custom &#8216;mouseenter&#8217; event. </p>
<p>We also only allow the click event when the mouse is inside of the circle.</p>
<p>In our example we will then apply our plugin to the regarding element. In our case, we are adding the hover class on &#8216;mouseenter&#8217; and removing it on &#8216;mouseleave&#8217;. </p>
<pre class="brush:js">
$('#circle').circlemouse({
	onMouseEnter	: function( el ) {

		el.addClass('ec-circle-hover');

	},
	onMouseLeave	: function( el ) {

		el.removeClass('ec-circle-hover');

	},
	onClick			: function( el ) {

		alert('clicked');

	}
});
</pre>
<p>Remember that the &#8220;normal&#8221; pseudo hover class is also defined in the noscript.css which gets applied when JavaScript is disabled. </p>
<p><strong>I hope you find this useful!</strong></p>
<p><a class="demo" href="http://tympanus.net/Development/HoverClickTriggerCircle/" >View demo</a> <a class="download" href="http://tympanus.net/Development/HoverClickTriggerCircle/HoverClickTriggerCircle.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/11/22/hover-and-click-trigger-circular-elements/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/tag/jquery/feed/ ) in 0.29701 seconds, on Feb 7th, 2012 at 12:27 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 7th, 2012 at 1:27 pm UTC -->
