<?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>MR. COKER [DOT] COM &#187; tutorials</title>
	<atom:link href="http://www.mrcoker.com/?feed=rss2&#038;cat=1" rel="self" type="application/rss+xml" />
	<link>http://www.mrcoker.com</link>
	<description>The exclusive portfolio and excellence of Ehren Coker.</description>
	<lastBuildDate>Mon, 29 Jun 2009 23:47:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Image Replacement with JQuery</title>
		<link>http://www.mrcoker.com/?p=3</link>
		<comments>http://www.mrcoker.com/?p=3#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:00:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.mrcoker.com/?p=3</guid>
		<description><![CDATA[I put this code snippet together for the menu system on my web site. By using some basic naming conventions with your image file, you can do an image replacement with JQuery in just a few lines.

First, you need to create two images. Let&#8217;s make them both .gif images so we can keep the files [...]]]></description>
			<content:encoded><![CDATA[<p>I put this code snippet together for the menu system on my web site. By using some basic naming conventions with your image file, you can do an image replacement with JQuery in just a few lines.</p>
<p><span id="more-3"></span></p>
<p>First, you need to create two images. Let&#8217;s make them both .gif images so we can keep the files small. For the hover image, add the extension &#8220;_hov&#8221; to whatever you named your first file.</p>
<p>Here are two example files:</p>

<a href='http://www.mrcoker.com/?attachment_id=19' title='example'><img width="150" height="100" src="http://www.mrcoker.com/wp-content/uploads/2009/06/example.gif" class="attachment-thumbnail" alt="" title="example" /></a>
<a href='http://www.mrcoker.com/?attachment_id=20' title='example_hov'><img width="150" height="100" src="http://www.mrcoker.com/wp-content/uploads/2009/06/example_hov.gif" class="attachment-thumbnail" alt="" title="example_hov" /></a>

<p> </p>
<p>Put them up there with some simple html:</p>
<pre class="ln-1"><code class="html">&lt;div id="links"&gt;
        	&lt;a href="#"&gt;&lt;img src="images/example.gif" /&gt;&lt;/a&gt;
&lt;/div&gt;</code></pre>
<p> </p>
<p> With the magic of <em>JQuery</em>, you can remove &#8220;.gif&#8221; from the end of the image name and replace it with &#8220;_hov.gif&#8221; on mouseover. It will do this for any &lt;a&gt; tags in the <strong>links</strong> div.</p>
<pre class="ln-1"><code class="js">$(document).ready(function() {
	$("#links a img").mouseout(function(){
	  	var imageName = $(this).attr("src");
		imageName = imageName.replace("_hov.gif", ".gif");
	  	$(this).attr("src", imageName);
	}).mouseover(function(){
	  	var imageName = $(this).attr("src");
	  	imageName = imageName.replace(".gif", "_hov.gif");
	  	$(this).attr("src", imageName);
	});
});</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mrcoker.com/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
