<?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; cody</title>
	<atom:link href="http://tympanus.net/codrops/author/cody/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Wed, 23 May 2012 09:46:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Latest Tweets Tooltip with jQuery</title>
		<link>http://tympanus.net/codrops/2010/07/20/latest-tweets-tooltip/</link>
		<comments>http://tympanus.net/codrops/2010/07/20/latest-tweets-tooltip/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 16:48:47 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[draggable]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tooltip]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2636</guid>
		<description><![CDATA[If you have a news website, it might be interesting for you to allow your users to see the latests tweets about a topic. Here is a jQuery plugin for showing the latest tweets about a certain word or phrase. For this plugin we are using the jQuery Twitter Search Plugin. Words or phrases that [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://tympanus.net/Development/LatestTweetsTooltip/" target="_blank"><img class="size-full wp-image-2641 aligncenter" title="LatestTweetsTooltip" src="http://tympanus.net/codrops/wp-content/uploads/2010/07/LatestTweetsTooltip.jpg" alt="" width="580" height="315" /></a></p>
<p>If you have a news website, it might be interesting for you to allow your users to see the latests tweets about a topic. Here is a jQuery plugin for showing the latest tweets about a certain word or phrase. </p>
<p>For this plugin we are using the <a href="http://jquery.malsup.com/twitter/">jQuery Twitter Search Plugin</a>.</p>
<p>Words or phrases that you want to be searched for in Twitter, are wrapped with the following span:</p>
<pre class="brush:xml">&lt;span class="twitter_search"&gt;Some search term&lt;/span&gt;</pre>
<p>The popup box that appears can be dragged and resized. Clicking on the cross will make it disappear. The tweets are constantly being loaded in a predefined time span. This loading stops when the user hovers over the tooltip box.</p>
<p>If you want to configure and restyle the tooltip, you will need to have a look at the configurations of the Twitter Search Plugin. Many parameters can be set here, from style to timings.</p>
<p>You can call the plugin like this:</p>
<pre class="brush:js">$(function() {
	$('#article').find('.twitter_search').twitterpopup();
});</pre>
<p>where #article should be replaced by the ID of your container.</p>
<p><a class="demo" href="http://tympanus.net/Development/LatestTweetsTooltip/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Development/LatestTweetsTooltip/LatestTweetsTooltip.zip">Download source</a></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/07/20/latest-tweets-tooltip/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Improved Micro Image Gallery: A jQuery Plugin</title>
		<link>http://tympanus.net/codrops/2010/04/26/improved-micro-image-gallery-a-jquery-plugin/</link>
		<comments>http://tympanus.net/codrops/2010/04/26/improved-micro-image-gallery-a-jquery-plugin/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 14:57:11 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1813</guid>
		<description><![CDATA[View demoDownload source Here&#8217;s an improved version of the Micro Image Gallery Plugin. I have added some features as suggested in the comments, specifically the auto play function, the possibility to add descriptions for each image, and the cycle mode. Note that the auto play function can only be set if the cycle option is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/MicroGalleryImproved/" target="_blank"><img class="aligncenter size-full wp-image-1818" title="igv2" src="http://tympanus.net/codrops/wp-content/uploads/2010/04/igv2.png" alt="" width="580" height="362" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/MicroGalleryImproved/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/MicroGalleryImproved/MicroGalleryImproved.zip">Download source</a></p>
<p>Here&#8217;s an improved version of the Micro Image Gallery Plugin. I have added some features as suggested in the comments, specifically the auto play function, the possibility to add descriptions for each image, and the cycle mode. Note that the auto play function can only be set if the cycle option is also set. To add descriptions for the images, just place your text inside the alt attribute of the image tag, like shown further in the HTML Structure section.</p>
<h3>The Plugin Parameters</h3>
<p>The plugin has the following configuration:</p>
<ul>
<li><strong>menu:</strong> Defines if the menu should be visible (true) or just appear when hovering over the gallery (false). The default value is true.</li>
<li><strong>size:</strong> The size of the image gallery: &#8220;small&#8221;, &#8220;medium&#8221; or &#8220;large&#8221;</li>
<li><strong>mode:</strong> The initial mode of the image gallery: &#8220;single&#8221; or &#8220;thumbs&#8221;</li>
<li><strong>cycle:</strong> If set to true, the first image will be displayed again when reaching the end of the gallery</li>
<li><strong>autoplay:</strong> If set to true, the gallery will jump from image to image automatically</li>
<li><strong>autoplayTime:</strong> The time in milliseconds that it takes to show the next image</li>
</ul>
<p>The three sizes of the image gallery define the following picture sizes (maximal height and width):</p>
<ul>
<li><strong>small:</strong> 102 pixels</li>
<li><strong>medium:</strong> 162 pixels</li>
<li><strong>large:</strong> 222 pixels</li>
</ul>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>HTML Structure</h3>
<p>All images should be wrapped in a div with class &#8220;microGallery&#8221;:</p>
<pre class="brush:xml">&lt;div id="mG1" class="microGallery"&gt;
    &lt;img src="gallery/2.jpg"/&gt;
	&lt;img src="gallery/3.jpg" alt="description comes here"/&gt;
	&lt;img src="gallery/4.jpg" alt="if you leave it empty then nothing will appear in the description container"/&gt;
	&lt;img src="gallery/5.jpg" alt="...and another description"/&gt;
&lt;/div&gt;
</pre>
<p>and you can call the plugin:</p>
<pre class="brush:js">$("#mG1").microgallery();
</pre>
<p>Please note that in IE no rounded borders or box shadows will be shown.</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/MicroGalleryImproved/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/MicroGalleryImproved/MicroGalleryImproved.zip">Download source</a></p>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/04/26/improved-micro-image-gallery-a-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Micro Image Gallery: A jQuery Plugin</title>
		<link>http://tympanus.net/codrops/2010/04/19/micro-image-gallery-a-jquery-plugin-2/</link>
		<comments>http://tympanus.net/codrops/2010/04/19/micro-image-gallery-a-jquery-plugin-2/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 23:03:43 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1796</guid>
		<description><![CDATA[View demoDownload source There&#8217;s a new version here: In many blogs and news sites images are mostly included as an addition to the content. Space is often limited and therefore we thought of a slick solution to integrate a miniature image gallery that does not occupy a lot of space. The following jQuery plugin transforms [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/MicroGallery/"><img class="aligncenter size-full wp-image-1797" title="micro" src="http://tympanus.net/codrops/wp-content/uploads/2010/04/micro1.png" alt="" width="580" height="362" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/MicroGallery/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/MicroGallery/MicroGallery.zip">Download source</a></p>
<p><strong>There&#8217;s a new version <a href="http://tympanus.net/codrops/2010/04/26/improved-micro-image-gallery-a-jquery-plugin/" target="_blank"><strong>here</strong></a>: </strong></p>
<p>In many blogs and news sites images are mostly included as an addition to the content. Space is often limited  and therefore we thought of a slick solution to integrate a miniature image gallery that does not occupy a lot of space.</p>
<p>The following jQuery plugin transforms a set of images into a tiny gallery with several options. The Micro Image Gallery allows to switch between a grid view which shows a preview of the images as thumbnails and a single view showing one image only. The navigation bar can be hidden and sliding out when hovering over the gallery, or visible. A total of nine thumbnails are shown in the grid preview. The plugin will automatically resize the image according to the chosen gallery size.</p>
<h3>The Plugin Parameters</h3>
<p>The plugin has the following configuration:</p>
<ul>
<li><strong>menu:</strong> Defines if the menu should be visible (true) or just appear when hovering over the gallery (false). The default value is true.</li>
<li><strong>size:</strong> The size of the image gallery: &#8220;small&#8221;, &#8220;medium&#8221; or &#8220;large&#8221;</li>
<li><strong>mode:</strong> The initial mode of the image gallery: &#8220;single&#8221; or &#8220;thumbs&#8221;</li>
</ul>
<p>The three sizes of the image gallery define the following picture sizes (maximal height and width):</p>
<ul>
<li><strong>small:</strong> 102 pixels</li>
<li><strong>medium:</strong> 162 pixels</li>
<li><strong>large:</strong> 222 pixels</li>
</ul>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>HTML Structure</h3>
<p>All images should be wrapped in a div with class &#8220;microGallery&#8221;:</p>
<pre class="brush:xml">&lt;div id="mG1" class="microGallery"&gt;
    &lt;img src="gallery/2.jpg"/&gt;
	&lt;img src="gallery/3.jpg"/&gt;
	&lt;img src="gallery/4.jpg"/&gt;
	&lt;img src="gallery/5.jpg"/&gt;
&lt;/div&gt;
</pre>
<p>and you can call the plugin:</p>
<pre class="brush:js">$("#mG1").microgallery();
</pre>
<p>Please note that in IE no rounded borders or box shadows will be shown.<br />
<strong>There&#8217;s a new version <a href="http://tympanus.net/codrops/2010/04/26/improved-micro-image-gallery-a-jquery-plugin/" target="_blank"><strong>here</strong></a>: </strong><br />
<a class="demo" href="http://tympanus.net/Tutorials/MicroGallery/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/MicroGallery/MicroGallery.zip">Download source</a></p>
<p><!-- wp_ad_camp_1 --></p>
<div class="partner_section_post"><span>Message from Testking</span>Get professional <a href="http://www.testkingsite.com/microsoft/70-649.html">testking 70-649</a> web designing training to learn how to create inspiring web designs using jQuery . download <a href="http://www.testkingsite.com/cisco/640-822.html">testking 640-822</a> tutorials and <a href="http://www.testkingsite.com/cisco/642-832.html">testking 642-832</a> study guides to become expert in web design.</div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/04/19/micro-image-gallery-a-jquery-plugin-2/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Neat Photo Hover Effect with CSS Sprites and jQuery</title>
		<link>http://tympanus.net/codrops/2010/02/22/neat-photo-hover-effect-with-css-sprites-and-jquery/</link>
		<comments>http://tympanus.net/codrops/2010/02/22/neat-photo-hover-effect-with-css-sprites-and-jquery/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 22:21:42 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[sprites]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1586</guid>
		<description><![CDATA[Here is a very nice effect for photos or some black and white images. We are using some CSS sprites for the photos to create a darken effect when hovering over the images. This could also be used with other effects. The basic principle is to create the impression that the background gets darker when [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tympanus.net/codrops/wp-content/uploads/2010/02/photoeffect1.png" alt="photoeffect" title="photoeffect" width="580" height="314" class="aligncenter size-full wp-image-1591" /></p>
<p>Here is a very nice effect for photos or some black and white images. We are using some CSS sprites for the photos to create a darken effect when hovering over the images. This could also be used with other effects. The basic principle is to create the impression that the background gets darker when hovering.</p>
<p>The CSS sprites image of each photo gets first loaded in the photo container. Then we add a paragraph element which has the same background image but a different background position (the dark half). This element gets faded in, so we have a smooth effect.</p>
<p><a class="demo" href="http://www.tympanus.net/Development/PhotoEffect/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/Development/PhotoEffect/PhotoEffect.zip">Download source</a></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<p><br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/02/22/neat-photo-hover-effect-with-css-sprites-and-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CSS Mania jQuery Plugin</title>
		<link>http://tympanus.net/codrops/2010/02/11/css-mania-jquery-plugin/</link>
		<comments>http://tympanus.net/codrops/2010/02/11/css-mania-jquery-plugin/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 18:45:07 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1313</guid>
		<description><![CDATA[Here is a jQuery plugin that makes use of the CSS Mania API. CSS Mania is a well known website showcase site where designs can be submitted and rated. A lot of information about each website is provided like the color scheme, the developer of the website, the creation date and many more. The API [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-1403" title="cssmania" src="http://tympanus.net/codrops/wp-content/uploads/2010/02/cssmania1.png" alt="cssmania" width="580" height="332" /></p>
<p>Here is a jQuery plugin that makes use of the CSS Mania API. <a href="http://cssmania.com/" target="_blank">CSS Mania</a> is a well known website showcase site where designs can be submitted and rated. A lot of information about each website is provided like the color scheme, the developer of the website, the creation date and many more. The API can be found <a href="http://cssmania.com/api/" target="_blank">here</a>.</p>
<p>The aim of this plugin is to retrieve all the data provided by the API concerning one website. You could, for example, use this to show the rating of your own site (if it is on CSS Mania) or to show how many votes your website already has. If you have more than one website on CSS Mania, you could as well display them with their information on your portfolio. There are surely many more ways to use this API, just be creative :)</p>
<p>The plugin has the following configuration:</p>
<ul>
<li><strong>website:</strong> Target website</li>
<li><strong>onInit:</strong> Function triggered, before calling the API</li>
<li><strong>onComplete:</strong> Function triggered, after receiving the response</li>
</ul>
<p style="text-align: center;"><a class="demo" href="http://www.tympanus.net/Tutorials/CSSManiajQueryPlugin/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/Tutorials/CSSManiajQueryPlugin/CSSManiajQueryPlugin.zip">Download source</a></p>
<p><div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div><br />
<br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/02/11/css-mania-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A jQuery Heat Map</title>
		<link>http://tympanus.net/codrops/2010/02/08/a-jquery-heat-map/</link>
		<comments>http://tympanus.net/codrops/2010/02/08/a-jquery-heat-map/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:15:46 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[heat map]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1305</guid>
		<description><![CDATA[Here is a very simple way ho to create a heat map with jQuery. The idea is to track the clicks of a user and then display the click pattern with semi-transparent dots on an overlay. You can try out the demo by first clicking around on the page and then clicking &#8220;Analyze&#8221;. Since the [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.tympanus.net/Tutorials/jQueryHeatMap/" target="_blank"><img class="size-full wp-image-1307 alignnone" title="heatMap" src="http://tympanus.net/codrops/wp-content/uploads/2010/02/heatMap.png" alt="heatMap" width="500" height="380" /></a></p>
<p>Here is a very simple way ho to create a heat map with jQuery. The idea is to track the clicks of a user and then display the click pattern with semi-transparent dots on an overlay. You can try out the demo by first clicking around on the page and then clicking &#8220;Analyze&#8221;. Since the dots are semi-transparent, spots that have been clicked on more often, will appear slightly darker. Click on the overlay to make it invisible again and continue with the &#8220;recording&#8221;.</p>
<p style="text-align: center;"><a class="demo" href="http://www.tympanus.net/Tutorials/jQueryHeatMap/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/Tutorials/jQueryHeatMap/jQueryHeatMap.zip">Download source</a></p>
<p><div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div><br />
<br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/02/08/a-jquery-heat-map/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Some Useful JavaScript &amp; jQuery Snippets &#8211; Part 4</title>
		<link>http://tympanus.net/codrops/2010/01/11/some-useful-javascript-jquery-snippets-part-4/</link>
		<comments>http://tympanus.net/codrops/2010/01/11/some-useful-javascript-jquery-snippets-part-4/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 10:43:10 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[useful]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1199</guid>
		<description><![CDATA[How to get client ip address with jQuery $.getJSON("http://jsonip.appspot.com?callback=?",function(data){ alert( "Your ip: " + data.ip); }); How to parse XML with jQuery file.xml: &#60;?xml version="1.0" ?&#62; &#60;result&#62; &#60;item&#62; &#60;id&#62;1&#60;/id&#62; &#60;title&#62;title1&#60;/title&#62; &#60;description&#62;desc1&#60;/description&#62; &#60;/item&#62; &#60;item&#62; &#60;id&#62;2&#60;/id&#62; &#60;title&#62;title2&#60;/title&#62; &#60;description&#62;desc2&#60;/description&#62; &#60;/item&#62; &#60;!-- ... --&#62; &#60;/result&#62; $.get('file.xml',{},function(data){ $('item',data).each(function(){ var $this       = $(this); var id             = $this.find('id').text(); var [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1210" title="snippets4" src="http://tympanus.net/codrops/wp-content/uploads/2010/01/snippets4.png" alt="snippets4" width="500" height="380" /></p>
<li><strong>How to get client ip address with jQuery</strong></li>
<pre class="brush:js">$.getJSON("http://jsonip.appspot.com?callback=?",function(data){
    alert( "Your ip: " + data.ip);
});</pre>
<li><strong>How to parse XML with jQuery</strong></li>
<p>file.xml:</p>
<pre class="brush:xml">&lt;?xml version="1.0" ?&gt;
&lt;result&gt;
    &lt;item&gt;
        &lt;id&gt;1&lt;/id&gt;
        &lt;title&gt;title1&lt;/title&gt;
        &lt;description&gt;desc1&lt;/description&gt;
    &lt;/item&gt;
    &lt;item&gt;
        &lt;id&gt;2&lt;/id&gt;
        &lt;title&gt;title2&lt;/title&gt;
        &lt;description&gt;desc2&lt;/description&gt;
    &lt;/item&gt;
    &lt;!-- ... --&gt;
&lt;/result&gt;</pre>
<pre class="brush:js">$.get('file.xml',{},function(data){
    $('item',data).each(function(){
        var $this       = $(this);
        var id             = $this.find('id').text();
        var title         = $this.find('title').text();
        var description = $this.find('description').text();
        //do something ...
    });
});</pre>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<li><strong>How to get the number in the ids</strong></li>
<pre class="brush:xml">&lt;div id="sites"&gt;
    &lt;a id="site_1" href="http://siteA.com"&gt;siteA&lt;/a&gt;
    &lt;a id="site_2" href="http://siteB.com"&gt;siteB&lt;/a&gt;
    &lt;a id="site_3" href="http://siteB.com"&gt;siteC&lt;/a&gt;
    ...
&lt;/div&gt;</pre>
<p>you need to get 1 from site_1, 2 from site_2 &#8230;</p>
<pre class="brush:js">$("#sites a").click(function(){
    var $this     = $(this);
    var nmb     = $this.attr('id').match(/site_(\d+)/)[1];
    ...
});</pre>
<li><strong>How to transform a number like 12343778 into 12.343.778</strong></li>
<pre class="brush:xml">&lt;div id="result"&gt;12343778&lt;/div&gt;</pre>
<pre class="brush:js">var delimiter = '.';
$('#result').html()
            .toString()
            .replace(new RegExp("(^\\d{"+($this.html().toString().length%3||-1)+"})(?=\\d{3})"),"$1" + delimiter)
            .replace(/(\d{3})(?=\d)/g,"$1" + delimiter);</pre>
<li><strong>Count number of textarea lines</strong></li>
<pre class="brush:js">var text = $("#textareaId").val();
var lines = text.split(/\r|\r\n|\n/);
alert(lines.length);</pre>
<li><strong>Logging to the firebug console</strong></li>
<pre class="brush:js">jQuery.fn.log = function (msg) {
    console.log("%s: %o", msg, this);
    return this;
};
$('#some_div').find('li.source &gt; input:checkbox').log("sources to uncheck").removeAttr("checked");</pre>
<li><strong>Find X/Y of an HTML element with Javascript</strong></li>
<pre class="brush:js">// Based on: http://www.quirksmode.org/js/findpos.html
var getCumulativeOffset = function (obj) {
    var left, top;
    left = top = 0;
    if (obj.offsetParent) {
        do {
            left += obj.offsetLeft;
            top  += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
    return {
        x : left,
        y : top
    };
};</pre>
<li><strong>Validate Credit Card</strong></li>
<pre class="brush:js">function isCreditCard( CC ){
    if (CC.length &gt; 19)
        return (false);

    sum = 0; mul = 1; l = CC.length;
    for (i = 0; i &lt; l; i++){
        digit = CC.substring(l-i-1,l-i);
        tproduct = parseInt(digit ,10)*mul;
        if (tproduct &gt;= 10)
            sum += (tproduct % 10) + 1;
        else
            sum += tproduct;
        if (mul == 1)
            mul++;
        else
            mul–;
    }
    if ((sum % 10) == 0)
        return (true);
    else
        return (false);
}</pre>
<li><strong>Distinguish left and right mouse click</strong></li>
<pre class="brush:js">$("#element").live('click', function(e) {
    if( (!$.browser.msie &amp;&amp; e.button == 0) || ($.browser.msie &amp;&amp; e.button == 1) ) {
        alert("Left Button");
    }
    else if(e.button == 2)
        alert("Right Button");
});</pre>
<li><strong>How to get the native image size</strong></li>
<pre class="brush:js">var img = $('#imageid');
var theImage = new Image();
theImage.src = img.attr("src");
alert("Width: " + theImage.width);
alert("Height: " + theImage.height);</pre>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/01/11/some-useful-javascript-jquery-snippets-part-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Some Useful JavaScript &amp; jQuery Snippets &#8211; Part 3</title>
		<link>http://tympanus.net/codrops/2010/01/08/some-useful-javascript-jquery-snippets-part-3/</link>
		<comments>http://tympanus.net/codrops/2010/01/08/some-useful-javascript-jquery-snippets-part-3/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 13:16:01 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[useful]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1162</guid>
		<description><![CDATA[How to hide all children div except a specific one with jQuery? $('#target div:not(#exclude)').hide(); //or $('#target').children().filter(':not(#exclude)').hide(); Detecting when a div’s height changes using jQuery $('element').bind('resize', function(){ alert( 'Height changed to' + $(this).height() ); } Delete all table rows except first $('someTableSelector').find('tr:gt(0)').remove(); Selecting root element of a certain level in the document 1 level: $('*:not(* *)'); [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1177" title="snippets_part3" src="http://tympanus.net/codrops/wp-content/uploads/2010/01/snippets_part3.png" alt="snippets_part3" width="500" height="380" /></p>
<li><strong>How to hide all children div except a specific one with jQuery?</strong></li>
<pre class="brush:js">$('#target div:not(#exclude)').hide();
//or
$('#target').children().filter(':not(#exclude)').hide();</pre>
<li><strong>Detecting when a div’s height changes using jQuery</strong></li>
<pre class="brush:js">$('element').bind('resize', function(){
alert( 'Height changed to' + $(this).height() );
}</pre>
<li><strong>Delete all table rows except first</strong></li>
<pre class="brush:js">$('someTableSelector').find('tr:gt(0)').remove();</pre>
<li><strong>Selecting root element of a certain level in the document</strong></li>
<pre class="brush:js">1 level:
$('*:not(* *)');
2 level:
$('*:not(* *)').find('&gt; *');
3 level:
$('*:not(* *)').find('&gt; * &gt; *');</pre>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<li><strong>Searching a string in jQuery</strong></li>
<pre class="brush:js">var foundin = $('*:contains("some string bla bla")');</pre>
<li><strong>Get the distance scrolled from top</strong></li>
<pre class="brush:js">alert($(document).scrollTop());</pre>
<li><strong>Select all elements except the ones with a given class</strong></li>
<pre class="brush:js">$('* :not(.someclass)')</pre>
<li><strong>Add a row to a table</strong></li>
<pre class="brush:js">$('#myTable tr:last').after('&lt;tr&gt;...&lt;/tr&gt;');</pre>
<li><strong>How to convert decimal to hexadecimal?</strong></li>
<pre class="brush:js">num = num.toString(16);
reverse process:
num = parseInt(num, 16);</pre>
<li><strong>Filtering By More Than One Attribute in JQuery</strong></li>
<pre class="brush:js">var elements = $('#someid input[type=sometype][value=somevalue]').get();</pre>
<li><strong>How to expire a cookie in x minutes</strong></li>
<pre class="brush:js">var date = new Date();
date.setTime(date.getTime() + (x * 60 * 1000));
$.cookie('example', 'foo', { expires: date });</pre>
<li><strong>Selecting the first x items with jQuery</strong></li>
<pre class="brush:js">example: first 10 anchors
$('a').slice(0,10);
//or
$('a:lt(10)');</pre>
<li><strong>Working with a select element</strong></li>
<pre class="brush:js">//Get the value of a selected option
$('selectElement').val();

//Get the text of a selected option
$('#selectElementId :selected').text();

//Remove an option (e.g. id=1)
$("#selectElementId option[value='1']").remove();</pre>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/01/08/some-useful-javascript-jquery-snippets-part-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Some Useful JavaScript &amp; jQuery Snippets &#8211; Part 2</title>
		<link>http://tympanus.net/codrops/2010/01/07/some-useful-javascript-jquery-snippets-part-2/</link>
		<comments>http://tympanus.net/codrops/2010/01/07/some-useful-javascript-jquery-snippets-part-2/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 17:05:15 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[useful]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1147</guid>
		<description><![CDATA[Check if cookies are enabled $(document).ready(function() { var dt = new Date(); dt.setSeconds(dt.getSeconds() + 60); document.cookie = "cookietest=1; expires=" + dt.toGMTString(); var cookiesEnabled = document.cookie.indexOf("cookietest=") != -1; if(!cookiesEnabled){ //cookies are not enabled } }); Toggle all checkboxes var tog = false; // or true if they are checked on load $('a').click(function() { $("input[type=checkbox]").attr("checked",!tog); tog = [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1152" title="snippets_part2" src="http://tympanus.net/codrops/wp-content/uploads/2010/01/snippets_part2.png" alt="snippets_part2" width="500" height="380" /></p>
<li><strong>Check if cookies are enabled</strong></li>
<pre class="brush:js">$(document).ready(function() {
    var dt = new Date();
    dt.setSeconds(dt.getSeconds() + 60);
    document.cookie = "cookietest=1; expires=" + dt.toGMTString();
    var cookiesEnabled = document.cookie.indexOf("cookietest=") != -1;
    if(!cookiesEnabled){
        //cookies are not enabled
    }
});</pre>
<li><strong>Toggle all checkboxes</strong></li>
<pre class="brush:js">var tog = false; // or true if they are checked on load
$('a').click(function() {
    $("input[type=checkbox]").attr("checked",!tog);
    tog = !tog;
});</pre>
<li><strong>Get the index of an element</strong></li>
<pre class="brush:js">$("ul &gt; li").click(function () {
    var index = $(this).prevAll().length;
});</pre>
<li><strong>Validate date of birth</strong></li>
<pre class="brush:js">$("#lda-form").submit(function(){
    var day = $("#day").val();
    var month = $("#month").val();
    var year = $("#year").val();
    var age = 18;
    var mydate = new Date();
    mydate.setFullYear(year, month-1, day);

    var currdate = new Date();
    currdate.setFullYear(currdate.getFullYear() - age);
    if ((currdate - mydate) &lt; 0){
        alert("Sorry, only persons over the age of " + age + " may enter this site");
        return false;
    }
    return true;
});</pre>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<li><strong>Test if an element is visible</strong></li>
<pre class="brush:js">if($(element).is(":visible")) {
    //The element is Visible
}</pre>
<li><strong>Counting child elements</strong></li>
<pre class="brush:js">&lt;div id="foo"&gt;
&lt;div id="bar"&gt;&lt;/div&gt;
&lt;div id="baz"&gt;
&lt;div id="biz"&gt;
&lt;/div&gt;
&lt;span&gt;&lt;span&gt;
&lt;/div&gt;

//jQuery code to count child elements
$("#foo &gt; div").length</pre>
<li><strong>Center an element on the screen</strong></li>
<pre class="brush:js">jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

//Use the above function as:
$(element).center();</pre>
<li><strong>Moving options from list A to list B</strong></li>
<pre class="brush:js">$().ready(function() {
    $('#add').click(function() {
        !$('#select1 option:selected').appendTo('#select2');
    });
    $('#remove').click(function() {
        !$('#select2 option:selected').appendTo('#select1');
    });
});</pre>
<li><strong>Select all checkboxes</strong></li>
<pre class="brush:js">$(document).ready(function(){
    $("#checkboxall").change(function(){
        var checked_status = this.checked;
        $("input[name=checkall]").attr("checked", checked_status);
    });

});</pre>
<li><strong>Get the current URL</strong></li>
<pre class="brush:js">$(document).ready(function() {
    var pathname = window.location.pathname;
});</pre>
<li><strong>Check if and which key was pressed</strong></li>
<pre class="brush:js">$(function() {
    $(document).keypress(function(e){
        switch(e.which){
        // "ENTER"
        case 13:
        alert('enter pressed');
        break;

        // "s"
        case 115:
        alert('s pressed');
        break;

        (...)

        }
    });

});</pre>
<p><!-- wp_ad_camp_1 --></p>
<div class="partner_section_post"><span>Message from Testking</span>We are among the best  <a href="http://www.pass4sure.com/CCIE-Service-Provider.html">ccie service provider</a>  to help you better prepare  for <a href="http://www.pass4sure.com/CCNA.html">ccna exam</a>. Sign up for online prep course to successfully pass <a href="http://www.pass4sure.com/CCIE-Wireless.html">ccie wireless</a>  certification.</div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/01/07/some-useful-javascript-jquery-snippets-part-2/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Pause and Play Effect with jQuery</title>
		<link>http://tympanus.net/codrops/2010/01/07/pause-and-play-effect-with-jquery/</link>
		<comments>http://tympanus.net/codrops/2010/01/07/pause-and-play-effect-with-jquery/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 16:32:34 +0000</pubDate>
		<dc:creator>cody</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[pause]]></category>
		<category><![CDATA[play]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=1137</guid>
		<description><![CDATA[View demoDownload source Here&#8217;s an effect based on the one used in fml to stop and pause an event. The idea is that when we click on the play/pause button or press the space button, an image (play or pause) appears and fades out. This effect is done using jQuery, which we use to animate [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1145" title="pausePlay" src="http://tympanus.net/codrops/wp-content/uploads/2010/01/pausePlay.png" alt="pausePlay" width="501" height="342" /></p>
<p><a class="demo" href="http://www.tympanus.net/PausePlay/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/PausePlay/PausePlay.zip">Download source</a></p>
<p>Here&#8217;s an effect based on the one used in <a href="http://live.fmylife.com/" target="_blank">fml</a> to stop and pause an event. The idea is that when we click on the play/pause button or press the space button, an image (play or pause) appears and fades out. This effect is done using jQuery, which we use to animate the image enlarging and fading out.</p>
<p>The images used for this effect:</p>
<p><img class="alignnone size-thumbnail wp-image-1140" title="play" src="http://tympanus.net/codrops/wp-content/uploads/2010/01/play1-150x150.png" alt="play" width="150" height="150" /> <img class="alignnone size-thumbnail wp-image-1141" title="pause" src="http://tympanus.net/codrops/wp-content/uploads/2010/01/pause1-150x150.png" alt="pause" width="150" height="150" /></p>
<p>The CSS:</p>
<pre class="brush:css">.player img{
position:absolute;
top:50%;
left:50%;
margin-top:-50px;
margin-left:-50px;
}</pre>
<p>The HTML:</p>
<pre class="brush:xml">&lt;a id="playbutton"&gt;Pause / Play&lt;/a&gt;
&lt;div id="player"&gt;
    &lt;img id="play" src="images/play.png" width="100" height="100" style="display:none;"/&gt;
    &lt;img id="pause" src="images/pause.png" width="100" height="100" style="display:none;"/&gt;
&lt;/div&gt;</pre>
<p>The jQuery:</p>
<pre class="brush:js">$(function() {
$(document).keypress(function(e){
if ((e.which &amp;&amp; e.which == 32) || (e.keyCode &amp;&amp; e.keyCode == 32)) {
togglePlay();
return false;
} else {
return true;
}
});
$('#playbutton').click(function(){
togglePlay();
return false;
});

function togglePlay(){
var $elem = $('#player').children(':first');
$elem.stop()
.show()
.animate({'marginTop':'-175px','marginLeft':'-175px','width':'350px','height':'350px','opacity':'0'},function(){
$(this).css({'width':'100px','height':'100px','margin-left':'-50px','margin-top':'-50px','opacity':'1','display':'none'});
});
$elem.parent().append($elem);
}
});</pre>
<p><a class="demo" href="http://www.tympanus.net/PausePlay/" target="_blank">View demo</a><a class="download" href="http://www.tympanus.net/PausePlay/PausePlay.zip">Download source</a></p>
<p><div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div><br />
<br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/01/07/pause-and-play-effect-with-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/author/cody/feed/ ) in 0.25668 seconds, on May 23rd, 2012 at 1:11 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 23rd, 2012 at 2:11 pm UTC -->
