<?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>UnDeprived &#187; jQuery</title>
	<atom:link href="http://www.un-deprived.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.un-deprived.com</link>
	<description>A webdev journal of the Moninator</description>
	<lastBuildDate>Thu, 29 Jul 2010 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Image maps within an image map</title>
		<link>http://www.un-deprived.com/2010/webdev/image-maps-within-an-image-map/</link>
		<comments>http://www.un-deprived.com/2010/webdev/image-maps-within-an-image-map/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 15:36:07 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[homepage]]></category>
		<category><![CDATA[hotspots]]></category>
		<category><![CDATA[image maps]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[new things]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=526</guid>
		<description><![CDATA[I finally launched the never-ending homepage redesign project yesterday for my company, so far so good, not everything I want, but at least got what my bosses want. I didn’t like the way how it was put together, but I had fun scripting with jQuery once again. This time, he wants to do “wipe up” [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.un-deprived.com/wp-content/uploads/eq2010screenshot.jpg" rel="lightbox[526]" title="Equus 2010 Homepage"><img src="http://www.un-deprived.com/wp-content/uploads/eq2010screenshot-226x124.jpg" alt="Equus 2010 Homepage" title="Equus 2010 Homepage" width="226" height="124" class="alignnone size-medium wp-image-525" /></a></p>
<p>I finally launched the never-ending homepage redesign project yesterday for my company, so far so good, not everything I want, but at least got what my bosses want. I didn’t like the way how it was put together, but I had fun scripting with jQuery once again. This time, he wants to do “wipe up” sort of effects and he resisted that me HTML-ing the hidden contents because he wants it “the way it is” for the contents. *dies* So I’m stuck with image maps… the loading time on the page is “glorious” to say the least… hey… I do what I asked of me. He didn’t want to hear loading time,  the web standards, best practices, and stuff like that. Although, I added the helpful image preloader plugin to speed things up just a bit, better than nothing. Over the course of the project, I’ve learned some little interesting things…</p>
<p><strong>Interesting things I’ve learned…</strong></p>
<ol>
<li>If you add “padding” around an image that has “hotspots” over it; IE (no matter what version)  WILL  offset the coordinates by the padding – the “hotspots” will be off by the amount of padding you put around the image. But in Firefox, the image map hotspots behave the way it should be. So if you need to adjust the spacing of the images when using image maps, use “margins”, don’t use “padding”. Took me a short while to figure this out…</li>
<li>Relative + absolute positions will snap pictures in any corner you want. In my case, I wanted the image to be lower left corner to achieve the “wiping” effect – otherwise, it’ll just “slide” the image out if you don’t absolute position it.
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">  	&lt;div style=&quot;position:relative&quot;&gt;
    	&lt;div style=&quot;position: absolute; bottom: 0; left: 0;&quot;&gt;Image here&lt;/div&gt;
    &lt;/div&gt;</pre>
</div>
</div>
</li>
<li>Too many image map hotspots is like Freddie Cougar’s face… ugly as hell and a freaking nightmare</li>
<li>jQuery $.each() saved  pounds of my hair once again</li>
<li>Do not add negative padding inside a jQuery.animate() – it will crash like a 100 cars pile-up on a highway…</li>
<li>Don’t try to explain to my boss why adding <em>more</em> image hotspots <em>inside</em> an image map is such a bad idea – he looks at me funny and starts getting pissy</li>
</ol>
<p>Besides all the pain and suffering for a month,  the most fun I got out of this project was scripting the animations and solving the “image map within an image map” problem. Here’s the run-down of the project:</p>
<ol>
<li>There will be main menu at the bottom of the screen, when the user hovers over each of time, the corresponding content (the image) will “wipe up” – I am calling this Tier 1 menu
<ol>
<li>Now “wiping” and “sliding” are two different animals, and my mini-boss <em>specifically</em> wants “wiping”, not “sliding”. So I had quite a bit of fun trying to make the image contents “wipe” up</li>
<li>Solution: create a “wrapper” div that wraps all the hidden “content images” – default the “wrapper” to 0px, then use jQuery to animate the height of the “Wrapper” to the full height when hover over. So I basically created a “mask” to do this hide the images. Attach the corresponding image, show, then “wipe” up</li>
</ol>
</li>
<li>Each of those image will have image map hotspots (no problem here)  </li>
<li>Within Tier 1 menu’s contents, one of the contents has multiple links within it and has a Tier 2 menu – better yet, the Tier 2 menu has four sub-contents WITH DIFFERENT unique image maps…</li>
</ol>
<p><strong>The Problem</strong></p>
<p>The problem? If you use the same map for all the images, they will have other hotspots showing up in images that you don’t want. Let’s say Image A is using #map1,  Image B needs to have the same menu but has different hotspot links. When Image B  uses #map1 again, well, all the hotspots intended for Image A will also  shows up. Of course, the obvious solution is to have multiple maps. The problem is the Tier 2 Menu shows/hides its contents. So if you have multiple maps, the Tier 2 Menu won’t able to hide and show content accordingly unless you want to code each of the Tier 2 menu with its own little script. Repetitive, inefficient, and probably won’t work.</p>
<p><strong>The Solution(s)</strong></p>
<p>After losing a couple hundreds of my hair, the solution? Create separate image maps for each of the unique hotspots map. So Image A gets its own map, Image B etc… use jQuery to clone the map according to the active menu and attach to the the “main map” (#map1), add a temporary class, and then remove them when the user hovers over a different menu item. Meaning: #map1 is the Tier 2 main menu and is defaulted to Image A. #map1 has the Tier 2 main menu, and the rest has its own unique hotspots maps <em>without</em> the Tier 2 Menu. Let’s say Image C has unique hotspot links, so when the user hovers over Image C. jQuery will tell this Image C to append #map3 hotspots (&lt;area&gt;) to #map1. When the user hovers to a different one, it removes all the previously attached “hotspots” – I identified them by adding a dummy class in each of the attached &lt;area&gt; map, then append another set if needed. Painful, but not bad for a workaround I think.</p>
<p>I find front-end development is like solving puzzles, and I love solving puzzles especially when it involves jQuery. Well, that’s it folks.</p>
<p><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2010/webdev/image-maps-within-an-image-map/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>jQuery CSV2Table — Modified</title>
		<link>http://www.un-deprived.com/2009/webdev/jquery-csv2table-modified/</link>
		<comments>http://www.un-deprived.com/2009/webdev/jquery-csv2table-modified/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 23:02:10 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[CSV2Table]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquery Journal]]></category>
		<category><![CDATA[jQuery Plugins]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=399</guid>
		<description><![CDATA[Version in this article: jQuery 1.3.2 / CSV2Table 0.03-b-2.9 Lately I started to like CSV (Common Separated Values) more and more comparing to XML.XML is a pain to setup even as entering data, then grabbing the data requires Einstein’s brain plus 3 sleepless and hair-pulling days of coding… okay, I maybe exaggerated a bit, but [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Version in this article: jQuery 1.3.2 / CSV2Table 0.03-b-2.9</p>
<p>Lately I started to like CSV (Common Separated Values) more and more comparing to XML.XML is a pain to setup even as entering data, then grabbing the data requires Einstein’s brain plus 3  sleepless and hair-pulling days of coding… okay, I maybe exaggerated a bit, but that’s how I feel about XML. My first encounter with CSV was InDesign, in there, you can import a bunch of data and generates PDF like Word’s Mail Merge feature. Then one day, someone asked me if I can find a better and easier way to help the non web people to maintain a site. I started out with search terms like “jQuery read text files” or something like that, one of the results returned as using CSV and there is a plugin called <a href="http://jsgt.org/lib/jquery/plugin/csv2table/v002/test.htm" target="_blank">CSV2Table</a> in the jQuery Plugins website by Toshiro Takahashi written earlier this year. Testing… <span id="more-399"></span>testing… and hot damned! It’s like magic!!!</p>
<p>The awesome thing about CSV is you can enter all the data using Excel, then simply save the file as something.csv and it’s ready to be used. No stupid header &lt;xml&gt;&lt;/xml&gt; tags, inner tags, child tags or whatever the heck tags. Just simple data. If you really, really want to be fancy; you can even add HTML such as &lt;img&gt; – believe it not, it worked like a charm. Although, it’s silly to format your CSV data within while you have your hands on the god-awsome jQuery framework to manipulate all of those data. Then to generate the table, all you simply have to do is:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#div&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">csv2table</span><span style="color: #009900;">&#40;</span>csvfile<span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span> <span style="color: #339933;">&lt;</span>em<span style="color: #339933;">&gt;</span>options<span style="color: #339933;">&lt;/</span>em<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Well, I’m not going to get into the <em>options</em> detail but you can refer back to the <a href="http://jsgt.org/lib/jquery/plugin/csv2table/v002/test.htm#nview0" target="_blank">CSV2Table docs</a>. You can manipulate how the data display, format, colorize, draw a dragon or whatever. This plugin is very flexible when it comes to formatting the results. Some people describe me as lazy, but I like to describe myself as “efficient” because I don’t like to repeat myself or do extra work. So it doesn’t make sense to write the code above everytime I need to reuse it, that’s just not the Mon’s way, here’s Mon’s way:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	<span style="color: #003366; font-weight: bold;">function</span> csvReader<span style="color: #009900;">&#40;</span>container<span style="color: #339933;">,</span>csvfile<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span>container<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">csv2table</span><span style="color: #009900;">&#40;</span>csvfile<span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
				sortable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				removeDoubleQuote <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				nowloadingMsg<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Loading &quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#eblastsYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; eblasts archive...&quot;</span><span style="color: #339933;">,</span>
				errorMsg <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Error loading &quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#eblastsYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; eBlasts archive. Archive either doesn't exist or renamed. Please contact Mon (mlu@equuscs.com) for support.&quot;</span><span style="color: #339933;">,</span>
				<span style="color: #000066;">onload</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>op<span style="color: #339933;">,</span>data<span style="color: #339933;">,</span>ary<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#totalEblasts&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>ary.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Display the total rows of the eblasts</span>
					$<span style="color: #009900;">&#40;</span>container<span style="color: #339933;">+</span><span style="color: #3366CC;">' tr:even'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'#efefef'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Every even row gets colorized</span>
					$<span style="color: #009900;">&#40;</span>container<span style="color: #339933;">+</span><span style="color: #3366CC;">' th'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;text-align&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Just setting the TH rows will be left aligned</span>
				 <span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>I wrote a function that because I know I’m going to reuse the code to load the <em>exact</em> same data, just maybe the CSV file or the DIV container might be different. Instead of writing re-writing again. If I ever need it, all I have to do is:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	csvReader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#csvContainer&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;data.csv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Done. Now, you probably wonder, what the heck did I use it for? Well, see screenshot:</p>
<p><a href="http://www.un-deprived.com/wp-content/uploads/csv.jpg" rel="lightbox[399]" title="csv"><img class="alignnone size-medium wp-image-400" title="csv" src="http://www.un-deprived.com/wp-content/uploads/csv-171x125.jpg" alt="csv" width="171" height="125" /></a></p>
<p>So when the user clicks on “View Archive”, it loads a new CSV file like this:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#selectYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">live</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    csvReader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#csv&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;eblasts/&quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#eblastsYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.csv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Less work = better. One  minor thing I felt missing was when the file is missing or failed to load, it just get stuck on the default “Now loading” message. I dug under the hood of the CSV2table codes, it uses $.get() to process the data which doesn’t really can tell whether the XHR request was successful or not; nor it can detect it unless you add the ajax.error() handle. So I’ve decided to change it to using the actual $.ajax() to call the data, and detect if there is a 404 error, it’ll display an error message accordingly instead of just “Loading…” – while I was at it, I felt, well, I and I’m pretty sure most people want to customize their sucessful load and error messages, right? So I added two more settings inside the plugin which are: <em>nowloadingMsg</em> and <em>errorMsg.</em> If you are so darn lazy and don’t want to customize it, it defaults to  “Now loading…” (fades out) and “CSV file not found.”. Here’s the modifications:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	op <span style="color: #339933;">=</span> $.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			url                <span style="color: #339933;">:</span> url<span style="color: #339933;">,</span>
			nowloadingImg      <span style="color: #339933;">:</span> $.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">loadImg</span><span style="color: #339933;">,</span>              <span style="color: #006600; font-style: italic;">//Image of now loading...</span>
			nowloadingMsg      <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>     						   <span style="color: #006600; font-style: italic;">//Message of now loading...</span>
			errorMsg		   <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>							   <span style="color: #006600; font-style: italic;">//Error Message</span>
       	<span style="color: #006600; font-style: italic;">// The rest of the codes...</span></pre>
</div>
</div>
<p>Do a search for “op.nowloadImg” and you’ll see “$.get()”.  I modified as follow around line 130 if you added what’s above:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	<span style="color: #006600; font-style: italic;">//Default loading message if not set in settings</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">nowloadingMsg</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> op.<span style="color: #660066;">nowloadingMsg</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Now loading...&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
    $<span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">before</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'
&lt;div class=&quot;csv2table-loading&quot;&gt;&lt;img src=&quot;'</span><span style="color: #339933;">+</span>op.<span style="color: #660066;">nowloadingImg</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot; alt=&quot;&quot; /&gt; '</span><span style="color: #339933;">+</span>op.<span style="color: #660066;">nowloadingMsg</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/div&gt;
'</span> <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Default error message</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">errorMsg</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> op.<span style="color: #660066;">errorMsg</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;CSV file not found.&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
       type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span>
       url<span style="color: #339933;">:</span> url<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;?&quot;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
       data<span style="color: #339933;">:</span> $.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
       success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #339933;">,</span>textSatus<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.csv2table-loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.csv2table-loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $<span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>mkRowsAry<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         setCSS<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $<span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">use_api</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'jqchart'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">use_api_type</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'jqchart:line'</span><span style="color: #009900;">&#41;</span>op.<span style="color: #660066;">type</span><span style="color: #339933;">=</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">type</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'line'</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">use_api_type</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'jqchart:bar'</span><span style="color: #009900;">&#41;</span>op.<span style="color: #660066;">type</span><span style="color: #339933;">=</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">type</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'bar'</span><span style="color: #339933;">;</span>
            useChart<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>op<span style="color: #339933;">,</span>data<span style="color: #339933;">,</span>$.<span style="color: #660066;">csv2table</span>._rowsAry<span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #000066;">onload</span><span style="color: #009900;">&#41;</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #000066;">onload</span><span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>op<span style="color: #339933;">,</span>data<span style="color: #339933;">,</span>$.<span style="color: #660066;">csv2table</span>._rowsAry<span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
       error <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>xhr<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>xhr.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">404</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// page not found</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.csv2table-loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;csv2table_error&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">errorMsg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>To sum it up for the CSV2Table mod, these are the changes I’ve made:</p>
<ul>
<li>2 extra settings: nowloadingMsg / errorMsg (defaults to “Now loading…” and “CSV file not found.”)</li>
<li>Changed $.get() method to $.ajax()</li>
<li>Added 1 extra CSS class: csv2table_error</li>
</ul>
<p>My modded: <a href='http://www.un-deprived.com/wp-content/uploads/jquery.csv2table-mod.js'>jquery.csv2table-mod</a><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/jquery-csv2table-modified/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>jQuery Journal: jEditable &amp; PHP Basic — Step by Step</title>
		<link>http://www.un-deprived.com/2009/webdev/jquery-journal-jeditable-php-basic-step-by-step/</link>
		<comments>http://www.un-deprived.com/2009/webdev/jquery-journal-jeditable-php-basic-step-by-step/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 13:42:49 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[jEditable]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquery Journal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=132</guid>
		<description><![CDATA[jEditable passes values as $_POST as default It grabs the ID from the container as value to the $_POST. Example: &#60;div id=&#34;item01&#34;&#62;Editable text&#60;/div&#62; To retrieve: $id = $_POST[’id’] will return “item01″ – this is meant to be passing unique ID. An example would be the Primary Auto-increment ID. Set a class and delcare it to [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<ol>
<li>jEditable passes values as $_POST as default</li>
<li>It grabs the ID from the container as value to the $_POST. Example: <span id="more-132"></span>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;div id=&quot;item01&quot;&gt;Editable text&lt;/div&gt;</pre>
</div>
</div>
<p>To retrieve: $id = $_POST[’id’] will return “item01″ – this is meant to be passing unique ID. An example would be the Primary Auto-increment ID.<!--more--></li>
<li>Set a class and delcare it to jEditable to make them editable. Example:
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;div id=&quot;unique-id-1&quot; class=&quot;editable&quot;&gt;This is the editable text&lt;/div&gt;
&lt;div id=&quot;unique-id-2&quot; class=&quot;editable&quot;&gt;This is the editable text&lt;/div&gt;</pre>
</div>
</div>
</li>
<li>The HTML
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">This is item 1
&nbsp;
This is item 2
&nbsp;
This is item 2</pre>
</div>
</div>
</li>
<li>Javascript:
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">		$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.editable'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">editable</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'jedit.php'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #3366CC;">&quot;indicator&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'Saving...'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;tooltip&quot;</span>   <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Click to edit...&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;type&quot;</span>		<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;textarea&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;cancel&quot;</span>	<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Cancel&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;submit&quot;</span>	<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Save&quot;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
</li>
<li> The PHP: jedit.php<br />
<strong><em>Note:</em></strong> <em>Must</em> re-echo the results for the<em> updated value(s)</em> to display the new value(s)</li>
<li>jEditable Configurations: you have the options to choose what to show up for an editable field. Such as a tooltip popup, what the submit button shows, or have a cancel button etc… you can see the full documentation on <a href="http://www.appelsiini.net/projects/jeditable" target="_blank">jEditable website</a>.</li>
</ol>
<p>If you want to pass multiple parameters, you can either use JSON or trick the ID to pass multiple fields. I have a hard time with JSON, so I tricked the ID part to pass multiple fields by using the PHP explode() function. For example:</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;div id=&quot;fieldname-&amp;lt;?=$id?&amp;gt;-tablename&quot; class=&quot;editable&quot;&gt;This is editable text&lt;/div&gt;</pre>
</div>
</div>
<p>Newb, but works.<!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/jquery-journal-jeditable-php-basic-step-by-step/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>jQuery Journal: each() vs Selectors</title>
		<link>http://www.un-deprived.com/2009/webdev/jquery-journal-each-vs-selectors/</link>
		<comments>http://www.un-deprived.com/2009/webdev/jquery-journal-each-vs-selectors/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 21:25:11 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[$(selectors)]]></category>
		<category><![CDATA[each()]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=117</guid>
		<description><![CDATA[One of the first few things I learned in jQuery, importantly enough that I can’t live without this function.  I like to note that when I first learned jQuery, I was a bit confused of the Selectors and the each() core function. After I got a hang of how to use the Selectors, I slowly [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>One of the first few things I learned in jQuery, importantly enough that I can’t live without this function.  I like to note that when I first learned jQuery, I was a bit confused of the Selectors and the each() core function. After I got a hang of how to use the Selectors, I slowly grasp the usage of each(). A few things to note about the two:</p>
<ul>
<li>$(selectors) selects <em>everything</em> that you feed to it</li>
<li>The each() function is used <em>conjunctionally</em> with $(selectors)</li>
<li>The each() function <em>separates</em> each of the returned item from the $(selectors) individually</li>
</ul>
<p><strong>Why you probably can’t live without each()</strong></p>
<p>Let’s say you want to change all the paragraphs (&lt;p&gt;) into I don’t know… say “No paragraph for you!” to all of them:</p>
<p>From:</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">This is a paragraph 1
&nbsp;
Second paragraph
&nbsp;
3rd paragraph</pre>
</div>
</div>
<p>To:</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">No paragraph for you!
&nbsp;
No paragraph for you!
&nbsp;
No paragraph for you!</pre>
</div>
</div>
<p>All you have to do is one fell swoop with jQuery:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;p&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;No paragraph for you!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>What if you  want to change the text individually ONLY when the user clicks on each of the paragraph? That’s when each() comes in as hero of the day:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;p&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;No paragraph for you!!!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p><a href="http://www.un-deprived.com/wp-content/uploads/2009/07/each.html">The above example</a> / <a href="http://www.un-deprived.com/wp-content/uploads/2009/07/image-swaps.html">Image Swap Example using each()</a></p>
<p>That’s just the most basic use of the each() function, if you still don’t see the light with the above examples, let me know.<!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/jquery-journal-each-vs-selectors/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>jQuery Journal: Easy jQuery image swap — Step by step</title>
		<link>http://www.un-deprived.com/2009/webdev/jquery-journal-easy-jquery-image-swap-step-by-step/</link>
		<comments>http://www.un-deprived.com/2009/webdev/jquery-journal-easy-jquery-image-swap-step-by-step/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 20:49:17 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[imageSwap]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[replaceImage]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=105</guid>
		<description><![CDATA[Image Swap Example Create thumbnails and dump them all in a “thumbs” folder with the same file names OR add something to identify the thumbnails such as: image01-th.jpg, image02-th.jpg etc… Place a container that holds the big image and give it an unique ID such as “big-image” OR give the image an unique ID - [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.un-deprived.com/wp-content/uploads/2009/07/image-swaps.html">Image Swap Example</a></p>
<ol>
<li>Create thumbnails and dump them all  in a “thumbs” folder with the same file names</li>
<li>OR add something to identify the thumbnails such as: image01-th.jpg, image02-th.jpg etc…<span id="more-105"></span></li>
<li>Place a container that holds the big image and give it an unique ID such as “big-image” OR give the image an unique ID -<strong> need a default image</strong>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;div id=&quot;big-image&quot;&gt;&lt;img src=&quot;imagename.jpg&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</pre>
</div>
</div>
<p>OR</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;"> 	&lt;img id=&quot;big-image&quot; src=&quot;bigimage01.jpg&quot; alt=&quot;&quot; /&gt;</pre>
</div>
</div>
</li>
<li>Place all of the thumbnails within a container such as: UL, unique ID div, or add a class to each of the thumbnail
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;ul id=&quot;thumbnails&quot;&gt;
	&lt;li&gt;&lt;img src=&quot;image01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src=&quot;image02.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
	&lt;li&gt;&lt;img src=&quot;image03.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
</div>
</div>
<p>OR</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;div id=&quot;thumbnails&quot;&gt;
        &lt;img src=&quot;image01.jpg&quot; alt=&quot;&quot; /&gt;
        &lt;img src=&quot;image02.jpg&quot; alt=&quot;&quot; /&gt;
        &lt;img src=&quot;image03.jpg&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</pre>
</div>
</div>
<p>OR</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">  	&lt;img class=&quot;thumbnails&quot; src=&quot;image01.jpg&quot; alt=&quot;&quot; /&gt;
    &lt;img class=&quot;thumbnails&quot; src=&quot;image02.jpg&quot; alt=&quot;&quot; /&gt;
    &lt;img class=&quot;thumbnails&quot; src=&quot;image03.jpg&quot; alt=&quot;&quot; /&gt;</pre>
</div>
</div>
<p><em>Note: </em>The last method is more flexible, it doesn’t have to be inside a container meaning the thumbnail can be placed anywhere. Just as long as the bigger image is shown at the exact same place.</li>
<li>Tell jQuery to find all the thumbnails, and every time the user hovers over each of the thumbnail – replace the “big-image” with the corresponding thumbnail path or file name</li>
</ol>
<p>To replace the path:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#thumbnails img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> src <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'thumbs'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// take out /thumbs/ before the file name</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#big-image'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>src<span style="color: #339933;">:</span> src<span style="color: #339933;">,</span> title<span style="color: #339933;">:</span> src<span style="color: #339933;">,</span> alt<span style="color: #339933;">:</span> src<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>To remove the “_th” identifiers:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#thumbnails img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> src <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'_th'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// take out '-th'</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#big-image'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>src<span style="color: #339933;">:</span> src<span style="color: #339933;">,</span> title<span style="color: #339933;">:</span> src<span style="color: #339933;">,</span> alt<span style="color: #339933;">:</span> src<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>To find all the “thumbnails” classes: <em>Simply replace $(‘#thumbnails img’) </em>with<em> $(‘.thumbnails’)</em><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/jquery-journal-easy-jquery-image-swap-step-by-step/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
	</channel>
</rss>
