<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>SweetVision</title>
	
	<link>http://www.sweetvision.com</link>
	<description>Javascript and other web programming topics</description>
	<lastBuildDate>Thu, 09 Jul 2009 11:00:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Sweetvision" /><feedburner:info uri="sweetvision" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Quick Tip: don’t use links with JavaScript unless the link goes some where</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/rwJD6GwK7uM/</link>
		<comments>http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:00:01 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Quick Tip]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/?p=121</guid>
		<description><![CDATA[We have all done it, many times I am sure.  You need an element to attach some JavaScript to, that will execute some function, so you use &#60;a href=&#8221;#&#8221; onclick=&#8221;myfunction(); return false;&#8221;&#62;click me&#60;/a&#62;.  The link does not go any where so we take steps to prevent the link from actually going any where. [...]]]></description>
			<content:encoded><![CDATA[<p>We have all done it, many times I am sure.  You need an element to attach some JavaScript to, that will execute some function, so you use &lt;a href=&#8221;#&#8221; onclick=&#8221;myfunction(); return false;&#8221;&gt;click me&lt;/a&gt;.  The link does not go any where so we take steps to prevent the link from actually going any where.  I say don&#8217;t use a link, use any other DOM element instead and style it like a link, if you actually want it to look like a link.</p>
<div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
&nbsp; &nbsp; .linkLike{<br />
&nbsp; &nbsp; &nbsp; cursor: pointer;<br />
&nbsp; &nbsp; &nbsp; text-decoration: underline;<br />
&nbsp; &nbsp; &nbsp; color: #0000ff;<br />
&nbsp; &nbsp; }<br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;linkLike&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;document.getElementById('clickie').innerHTML += 'clickity click&lt;hr /&gt;</span></span>'&quot;&gt;Click Here<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clickie&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>
	<style>
		.linkLike{
			cursor: pointer;
			text-decoration: underline;
			color: #0000ff;
		}
	</style>
	<span class="linkLike" onclick="document.getElementById('clickie').innerHTML += 'clickity click<hr />'">Click Here</span> &nbsp; &nbsp; <span class="linkLike" onclick="document.getElementById('clickie').innerHTML = ''">Clear</span>
	<div id="clickie"></div>
</p>
<p>I can think of one situation that you would actually want to use links and that is if you want the link to go some where in the case that JavaScript is disabled.  You could for instance take users to a page detailing the need for JavaScript for the page to function properly with instructions to enable JavaScript.</p>
<p><p><script type="text/javascript"><!--
google_ad_client = "pub-9003667938281138";
/* sweetvision inline - 468x60, created 6/30/09 */
google_ad_slot = "1463395810";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p></p>
<p><map name='google_ad_map_121_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/121?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_121_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=121&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F07%2F09%2Fquick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where+http://bit.ly/17I2OC" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where+http://bit.ly/17I2OC" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/&amp;submitHeadline=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/&amp;title=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/&amp;title=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where&amp;link=http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/&amp;title=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/&amp;title=Quick+Tip%3A+don%27t+use+links+with+JavaScript+unless+the+link+goes+some+where" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/BCp-4Gn0s2YGjTEzklJeHyWh84k/0/da"><img src="http://feedads.g.doubleclick.net/~a/BCp-4Gn0s2YGjTEzklJeHyWh84k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/BCp-4Gn0s2YGjTEzklJeHyWh84k/1/da"><img src="http://feedads.g.doubleclick.net/~a/BCp-4Gn0s2YGjTEzklJeHyWh84k/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/rwJD6GwK7uM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/07/09/quick-tip-dont-use-links-with-javascript-unless-the-link-goes-some-where/</feedburner:origLink></item>
		<item>
		<title>How to use object oriented programming with jQuery</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/QpCqZLwjGLQ/</link>
		<comments>http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 11:00:22 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Object Oriented]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/?p=86</guid>
		<description><![CDATA[Unlike many other JavaScript frameworks jQuery provides few object oriented programming utilities, since JavaScript is all ready object oriented there is no need to.  That being said, the means of using object oriented programming with jQuery are limited by some aspects of jQuery it&#8217;s self. jQuery is really a function that returns a jQuery [...]]]></description>
			<content:encoded><![CDATA[<p>Unlike many other JavaScript frameworks jQuery provides few object oriented programming utilities, since JavaScript is all ready object oriented there is no need to.  That being said, the means of using object oriented programming with jQuery are limited by some aspects of jQuery it&#8217;s self. jQuery is really a function that returns a jQuery object or an array of jQuery objects.  That can be confusing since there is both a jQuery function and a jQuery object.  Due to this fact there is nothing exactly to sub-class before the jQuery function has returned a jQuery object.  What you can do is define a JavaScript object that specifies your own member variables and functions. Once you retrieve a jQuery object, you can use the jQuery.extend() function to copy the members of your object to the returned jQuery object.</p>
<p>Here is a simple example to illustrate:</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;!</span>DOCTYPE HTML <span style="color: #003366; font-weight: bold;">PUBLIC</span> <span style="color: #3366CC;">&quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span><br />
&nbsp;<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span><br />
&nbsp; <span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span> Object Oriented jQuery <span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span><br />
&nbsp; <span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;jquery-1.3.2.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span><br />
&nbsp; <span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;JavaScript&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> hideMeShowMe <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; hideME<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><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'baseDisplay'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'none'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; showMe<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><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'baseDisplay'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <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><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> pageElement <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#myElement'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jQuery.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>pageElement<span style="color: #339933;">,</span> hideMeShowMe<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pageElement.<span style="color: #660066;">hideME</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span><br />
&nbsp; <span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span><br />
&nbsp;<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span><br />
&nbsp; <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;myElement&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">This</span> <span style="color: #000066; font-weight: bold;">is</span> hideable<br />
&nbsp; <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span><br />
&nbsp;<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p></p>
<p>This allows you to extend a single jQuery object with your object&#8217;s functionality.  There is another approach that you could take which is to use the jQuery.fn.endtend function.  That function will cause all of your objects members to be copied to all jQuery objects returned by the jQuery function, that is how plugins work.  Which approach you use depends on what you are trying to do, if you are going to make one kind of control that has a specific purpose, it makes sense to use the approach I cover here instead of adding it as a plugin.  If you are going to add functionality that will be used more broadly then it makes more sense to add that functionality as a plugin.</p>
<p>This is part of my ongoing series of posts exploring the use of jQuery and object oriented JavaScripts, you might be interested in these posts as well:</p>
<ul>
<li><a href="http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/" title="jQuery makes me go hmmm">jQuery makes me go hmmm</a></li>
<li><a href="http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/" title="jQuery is object oriented">jQuery is object oriented</a></li>
</ul>
<p><map name='google_ad_map_86_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/86?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_86_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=86&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F07%2F07%2Fhow-to-use-object-oriented-programming-with-jquery%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=How+to+use+object+oriented+programming+with+jQuery+http://bit.ly/xa5wg" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=How+to+use+object+oriented+programming+with+jQuery+http://bit.ly/xa5wg" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/&amp;submitHeadline=How+to+use+object+oriented+programming+with+jQuery" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/&amp;title=How+to+use+object+oriented+programming+with+jQuery" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/&amp;title=How+to+use+object+oriented+programming+with+jQuery" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=How+to+use+object+oriented+programming+with+jQuery&amp;link=http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/&amp;title=How+to+use+object+oriented+programming+with+jQuery" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/&amp;title=How+to+use+object+oriented+programming+with+jQuery" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/AEUcoN0VgSOzOjI0S5ffpCc13RE/0/da"><img src="http://feedads.g.doubleclick.net/~a/AEUcoN0VgSOzOjI0S5ffpCc13RE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/AEUcoN0VgSOzOjI0S5ffpCc13RE/1/da"><img src="http://feedads.g.doubleclick.net/~a/AEUcoN0VgSOzOjI0S5ffpCc13RE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/QpCqZLwjGLQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/</feedburner:origLink></item>
		<item>
		<title>Twitter Name change, the name should reflect the spam</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/ZnMN51NIfXc/</link>
		<comments>http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 14:53:39 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/</guid>
		<description><![CDATA[Hey I know, this post has nothing to do with the trend you were looking at when you clicked the link to get here.  I  tweeted there just to make a point, trends are broken and full of spam!
So I have been working on some bits of code to analyze the twitter trending [...]]]></description>
			<content:encoded><![CDATA[<p>Hey I know, this post has nothing to do with the trend you were looking at when you clicked the link to get here.  I  tweeted there just to make a point, trends are broken and full of spam!</p>
<p>So I have been working on some bits of code to analyze the twitter trending topics.  I figure it would be a great way to be aware of what is going on in the general social consciousness.  So I developed some code to pull the current trends and also list the recent tweets for those trends to give them context.  Over the last few weeks I have been monitoring my prototype and making tweaks here and there.  One cool thing about it is that I am much more aware of what is going on in the world, at least the world according to twitter.  This morning I was looking at the tweets for the Spain trend and over half the tweets were spam.  The more of them I read the more I was getting turned off of twitter.  Currently I don&#8217;t think twitter has any spam fighting systems in place at all, it sure does not seem to any way.  It got me to thinking about how the spammers are actually altering the trends and that as they spam a trend it makes the trend artificially strong.  So not only are the spammers junking up the stream they are also diverting it as well.</p>
<p>With FaceBook about to release public feeds; I think Twitter had better start working fast and furious on fixing the spam issue.  FaceBook&#8217;s greater verification of people, and strong desire to take Twitter&#8217;s traffic could make Twitter&#8217;s traffic surge just a blip on the internet stat counters.  Frankly I am torn between wanting FaceBook to be the main public stream and Twitter.  FaceBook allows longer updates and integrates video and link sharing, but Twitter gives me all of the fresh stats, feels more mashupable, and is over all much simpler.</p>
<p></p>
<p>Any one have any suggestions on what we should rename twitter so that it reflects its new spammie nature? Spitter? Spameme?</p>
<p><map name='google_ad_map_55_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/55?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_55_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=55&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F06%2F25%2Ftwitter-name-change-the-name-should-reflect-the-spam%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=Twitter+Name+change%2C+the+name+should+reflect+the+spam+http://bit.ly/OawYH" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=Twitter+Name+change%2C+the+name+should+reflect+the+spam+http://bit.ly/OawYH" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/&amp;submitHeadline=Twitter+Name+change%2C+the+name+should+reflect+the+spam" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/&amp;title=Twitter+Name+change%2C+the+name+should+reflect+the+spam" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/&amp;title=Twitter+Name+change%2C+the+name+should+reflect+the+spam" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Twitter+Name+change%2C+the+name+should+reflect+the+spam&amp;link=http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/&amp;title=Twitter+Name+change%2C+the+name+should+reflect+the+spam" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/&amp;title=Twitter+Name+change%2C+the+name+should+reflect+the+spam" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/T1oQRzB9ydJKv8X8EXRieJ21PqM/0/da"><img src="http://feedads.g.doubleclick.net/~a/T1oQRzB9ydJKv8X8EXRieJ21PqM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/T1oQRzB9ydJKv8X8EXRieJ21PqM/1/da"><img src="http://feedads.g.doubleclick.net/~a/T1oQRzB9ydJKv8X8EXRieJ21PqM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/ZnMN51NIfXc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/06/25/twitter-name-change-the-name-should-reflect-the-spam/</feedburner:origLink></item>
		<item>
		<title>jQuery makes me go hmmm</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/QqBfNz8wn5s/</link>
		<comments>http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 14:56:08 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Object Oriented]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/</guid>
		<description><![CDATA[So I was busy looking into the ways to use jQuery in a prototype based object oriented fashion and was having a devil of a time geting it to work.  I eventually turned to Goolge for help and I discovered this thread which is a discussion of sub-classing the jQuery object.  It is [...]]]></description>
			<content:encoded><![CDATA[<p>So I was busy looking into the ways to use jQuery in a prototype based object oriented fashion and was having a devil of a time geting it to work.  I eventually turned to Goolge for help and I discovered <a href="http://markmail.org/message/vpysx4bdhd7pyi6z#query:+page:1+mid:x3mx3o6uozpq44y5+state:results" target="_blank">this thread</a> which is a discussion of sub-classing the jQuery object.  It is mostly a back and forth between John Resig and Nate Cavanaugh covering Nate&#8217;s attempts at sub-classing jQuery.  The long and short of the discussion is that jQuery has so many references to the global jQuery object that it cannot be cleanly sub-classed</p>
<p>So my initial concept was to subclass the jQuery object in my own objects to make new JavaScript objects with all of the functions of jQuery as well as my additions, but that is not going to work.  That being said jQuery has a number of methods of adding objects and functions to jQuery; which is basically how plugins are developed.  I will explore extending the jQuery and JQuery.fn objects with my own objects next.</p>
<p>This is part of my ongoing series of posts exploring the use of jQuery and object oriented JavaScripts, you might be interested in these posts as well:</p>
<ul>
<li><a href="http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/" title="How to use object oriented programming with jQuery">How to use object oriented programming with jQuery</a></li>
<li><a href="http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/" title="jQuery is object oriented">jQuery is object oriented</a></li>
</ul>
<p><map name='google_ad_map_54_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/54?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_54_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=54&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F06%2F24%2Fjquery-makes-me-go-hmmm%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=jQuery+makes+me+go+hmmm+http://bit.ly/wSKI3" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=jQuery+makes+me+go+hmmm+http://bit.ly/wSKI3" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/&amp;submitHeadline=jQuery+makes+me+go+hmmm" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/&amp;title=jQuery+makes+me+go+hmmm" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/&amp;title=jQuery+makes+me+go+hmmm" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=jQuery+makes+me+go+hmmm&amp;link=http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/&amp;title=jQuery+makes+me+go+hmmm" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/&amp;title=jQuery+makes+me+go+hmmm" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/grMRxotoTuMCM3QurWpvJ1Km2eQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/grMRxotoTuMCM3QurWpvJ1Km2eQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/grMRxotoTuMCM3QurWpvJ1Km2eQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/grMRxotoTuMCM3QurWpvJ1Km2eQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/QqBfNz8wn5s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/</feedburner:origLink></item>
		<item>
		<title>jQuery is object oriented</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/U9dopi0lgOk/</link>
		<comments>http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 14:54:30 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Object Oriented]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/</guid>
		<description><![CDATA[﻿When I first looked at the jQuery frame work, a few years ago I immediately discounted it as a viable framework.  My whole reason for that decision was that it did not add a traditional class based object oriented layer.  A little more than a year later I started reading about jQuery&#8217;s speed [...]]]></description>
			<content:encoded><![CDATA[<p>﻿When I first looked at the jQuery frame work, a few years ago I immediately discounted it as a viable framework.  My whole reason for that decision was that it did not add a traditional class based object oriented layer.  A little more than a year later I started reading about jQuery&#8217;s speed and small size.  I decided that I would give it a full chance and start using it on a few projects.  I found many advantages to jQuery but was still turned off by its apparent lack of object oriented features.  I wrote a blog post to that affect and the response was rather vehement as many took my statement that &#8220;you should not choose jQuery if you wanted an object oriented framework,&#8221; to be a condemnation of jQuery.  Some statements though were rather enlightening, specifically ones that pointed out that JavaScript is all ready object oriented and does not need a framework to make it so.</p>
<p></p>
<p>That last point was interesting as I all ready knew that JavaScript was an object oriented language, but since it did not do objects like I learned to do them in C++ and PHP it sort of slid under my obvious filter.  Suddenly I realized I need to look into how JavaScript was object oriented, started learning about Prototype-based programming, and learn how JavaScript uses it.  This began a cascade of shifting thought about how to program in JavaScript and how to use jQuery.  So now I am exploring how to create objects in a JavaScript centric way and how to do object oriented jQuery development.</p>
<p>
Some things to take away from this little post is that JavaScript is object orented, JavaScript is a prototype based language and jQuery is a prototype centric JavaScript library.</p>
<p>This is part of my ongoing series of posts exploring the use of jQuery and object oriented JavaScripts, you might be interested in these posts as well:</p>
<ul>
<li><a href="http://www.sweetvision.com/2009/07/07/how-to-use-object-oriented-programming-with-jquery/" title="How to use object oriented programming with jQuery">How to use object oriented programming with jQuery</a></li>
<li><a href="http://www.sweetvision.com/2009/06/24/jquery-makes-me-go-hmmm/" title="jQuery makes me go hmmm">jQuery makes me go hmmm</a></li>
</ul>
<p><map name='google_ad_map_53_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/53?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_53_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=53&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F06%2F22%2Fjquery-is-object-orented%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=jQuery+is+object+oriented+http://bit.ly/6oFf4" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=jQuery+is+object+oriented+http://bit.ly/6oFf4" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/&amp;submitHeadline=jQuery+is+object+oriented" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/&amp;title=jQuery+is+object+oriented" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/&amp;title=jQuery+is+object+oriented" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=jQuery+is+object+oriented&amp;link=http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/&amp;title=jQuery+is+object+oriented" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/&amp;title=jQuery+is+object+oriented" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/v7PDziT35L4Vj9wkaZXw77NkVZk/0/da"><img src="http://feedads.g.doubleclick.net/~a/v7PDziT35L4Vj9wkaZXw77NkVZk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/v7PDziT35L4Vj9wkaZXw77NkVZk/1/da"><img src="http://feedads.g.doubleclick.net/~a/v7PDziT35L4Vj9wkaZXw77NkVZk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/U9dopi0lgOk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/06/22/jquery-is-object-orented/</feedburner:origLink></item>
		<item>
		<title>The one real reason to not use JQuery</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/9LhJTCGCyTE/</link>
		<comments>http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 20:53:14 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[DOM]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Object Oriented]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/</guid>
		<description><![CDATA[JQuery is a very nice for DOM manipulation and access.&#160; As I mentioned in my last post, JQuery uses standard CSS selectors by default which is very nice.&#160; You can create fairly complex actions with very few lines of code.
What it does not have that MooTools and Prototype.js both have is a rich set of [...]]]></description>
			<content:encoded><![CDATA[<p>JQuery is a very nice for DOM manipulation and access.&nbsp; <a href="http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/">As I mentioned in my last post</a>, JQuery uses standard CSS selectors by default which is very nice.&nbsp; You can create fairly complex actions with very few lines of code.</p>
<p>What it does not have that MooTools and Prototype.js both have is a rich set of object oriented oriented development functions.&nbsp; JQuery is ver DOM centric and does not have much in the way of utilities that are not directly related to accessing and manipulating the DOM.&nbsp; You can greatly extend the functions of elements in the DOM or add elements to the DOM.&nbsp; Once you are working with pure JavaScript objects JQuery does not have much to offer.&nbsp; This begins to become eveident right away when compairing the core sections of both MooTools and JQuery.&nbsp; In JQuery&#8217;s core the first things are DOM element access and creation functions; where MooTools&#8217; core is all JavaScript and OO featrues.&nbsp; The Extend function is a good example, extend is a core componenet of MooTools and a Utility in Jquery.</p>
<p>Beyond that the true reason for using MooTools is the the object oriented programming features.&nbsp; The Function and Class features of MooTools are simply not implimented in JQuery.&nbsp; This makes taking advantage of Encapsulation, Inheritance and Polymorphism very difficult with JQuery, which pretty much leaves all of the work of implementation of those features up to you.&nbsp; </p>
<p>That being said you can use the <span>JQuery&#8217;s noConflict()</span> function and use both MooTools and JQuery.&nbsp; I have not explored how the two will play together when writing object oriented code with Mootools functions and accessing the DOM with JQuery, but I do plan to give this a try in the near future. </p>
<p></p>
<p><map name='google_ad_map_52_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/52?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_52_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=52&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F02%2F02%2Fthe-one-real-reason-to-not-use-jquery%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=The+one+real+reason+to+not+use+JQuery+http://bit.ly/16SN4R" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=The+one+real+reason+to+not+use+JQuery+http://bit.ly/16SN4R" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/&amp;submitHeadline=The+one+real+reason+to+not+use+JQuery" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/&amp;title=The+one+real+reason+to+not+use+JQuery" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/&amp;title=The+one+real+reason+to+not+use+JQuery" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=The+one+real+reason+to+not+use+JQuery&amp;link=http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/&amp;title=The+one+real+reason+to+not+use+JQuery" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/&amp;title=The+one+real+reason+to+not+use+JQuery" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/dZUP5t5T08Id3XcQmjFvktejuoA/0/da"><img src="http://feedads.g.doubleclick.net/~a/dZUP5t5T08Id3XcQmjFvktejuoA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dZUP5t5T08Id3XcQmjFvktejuoA/1/da"><img src="http://feedads.g.doubleclick.net/~a/dZUP5t5T08Id3XcQmjFvktejuoA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/9LhJTCGCyTE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/</feedburner:origLink></item>
		<item>
		<title>Three real good reasons to use JQuery, from a Mootools lover</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/vH23Lj_o7z8/</link>
		<comments>http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 06:29:09 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[DOM]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/</guid>
		<description><![CDATA[I have been an avid mootools user for many years.  A couple of times I have looked at JQuery and turned up my nose.  That being said I am a firm believer that one should reassess ones knowledge/opinions/assumptions periodically just to make sure the world has not changed while you were not looking. [...]]]></description>
			<content:encoded><![CDATA[<p>I have been an avid mootools user for many years.  A couple of times I have looked at JQuery and turned up my nose.  That being said I am a firm believer that one should reassess ones knowledge/opinions/assumptions periodically just to make sure the world has not changed while you were not looking.  This is one time that the reassessment did indeed change what I believe, and here are 3 things making that change:</p>
<p><b>Community Support</b></p>
<p>JQuery has a large community of active users.  This makes finding information supplementary to the JQuery official documentation very easy.  JQuery&#8217;s community also means that when you post a question some where you will not wait long for an answer.</p>
<p><b>Selectors</b></p>
<p>JQuery uses the same selectors as CSS.  When working with a team of both developers and designers this is wonderful.  When it comes to addressing the DOM with JQuery both the designers and the developers are speaking the same language.  Every bridge you can build between your developers and designers makes for a stronger team.  Not to mention using CSS selectors is just easier than all the hoops you have to jump through in other frameworks.</p>
<p><b>Speed</b></p>
<p>With the release of version 1.3 of the JQuery framework, many of the functions are faster than any other JavaScript framework.  With the ever increasing amount of JavaScript executing on a page the speed is a welcome relief.</p>
<p>These are three very important reasons to take another look at JQuery.</p>
<p>I have done a little more playing around with JQuery and have found <a href="http://www.sweetvision.com/2009/02/02/the-one-real-reason-to-not-use-jquery/">one major draw back when compared to Mootools</a></p>
<p></p>
<p><map name='google_ad_map_51_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/51?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_51_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=51&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2009%2F01%2F29%2Fthree-real-good-reasons-to-use-jquery-from-a-mootools-lover%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover+http://bit.ly/15oTOF" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover+http://bit.ly/15oTOF" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/&amp;submitHeadline=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/&amp;title=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/&amp;title=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover&amp;link=http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/&amp;title=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/&amp;title=Three+real+good+reasons+to+use+JQuery%2C+from+a+Mootools+lover" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/vzYcAr25OqI276ty24ZKj3zuw3A/0/da"><img src="http://feedads.g.doubleclick.net/~a/vzYcAr25OqI276ty24ZKj3zuw3A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/vzYcAr25OqI276ty24ZKj3zuw3A/1/da"><img src="http://feedads.g.doubleclick.net/~a/vzYcAr25OqI276ty24ZKj3zuw3A/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/vH23Lj_o7z8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2009/01/29/three-real-good-reasons-to-use-jquery-from-a-mootools-lover/</feedburner:origLink></item>
		<item>
		<title>How to: Use MooTools to Fade Between Multiple Images</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/id9neVLmX4Q/</link>
		<comments>http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 18:06:37 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[DOM]]></category>
		<category><![CDATA[FX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[createElement]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[fade]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[preload]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/</guid>
		<description><![CDATA[After I wrote my post &#8220;Using MooTools to fade between two images&#8221; I have received many request on how to fade between multiple images.  So here is &#8220;How to: Use MooTools to Fade Between Multiple Images&#8221;.  We start with the same HTML setup as we do in &#8220;Using MooTools to fade between two [...]]]></description>
			<content:encoded><![CDATA[<p>After I wrote my post &#8220;<a href="http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/">Using MooTools to fade between two images</a>&#8221; I have received many request on how to fade between multiple images.  So here is &#8220;How to: Use MooTools to Fade Between Multiple Images&#8221;.  We start with the same HTML setup as we do in &#8220;Using MooTools to fade between two images&#8221; plus a few buttons; setup two DIV tags that are absolutely positioned over one another inside another DIV tag that uses default placement. Then you place your image tags inside each of the absolutely positioned DIV tags. Each of the DIV tags needs to have an id attribute so they can be referenced in your javascript code.</p>
<p>The HTML for the task will look like this:</p>
<div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button1&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle(this.image.src);&quot;</span>&gt;</span>Image 1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button2&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle(this.image.src);&quot;</span>&gt;</span>Image 2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button3&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle(this.image.src);&quot;</span>&gt;</span>Image 3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button4&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toggle(this.image.src);&quot;</span>&gt;</span>Image 4<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;height:112px;&quot;</span> &gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;div1&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; opacity: 0;&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image1&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image1.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;div2&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; opacity: 1;&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image2&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image2.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>
For fading between multiple images there is some preparation we will need to do before we are ready to start switching images.  First you need to create an object to associate buttons to your image source URLs, this makes it easy to change the number of buttons and images they load later.  Then iterate that object creating new <img> elements for each image and attaching them to the buttons.  Creating new images and attaching them to the buttons does two things, it pre-loads the images and associates the image to the button that will show the image.
</p>
<p>creating the object can be done with JavaScript Object Notation:</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> buttonsAndImages <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'button1'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image1.jpg'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'button2'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image2.jpg'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'button3'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image3.jpg'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'button4'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image4.jpg'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>
The loadImages function will take the buttionsAndImages object and create a new image object using the Mootools Element object and attach that image object to its associated button.
</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> loadImages<span style="color: #009900;">&#40;</span>buttonsAndImages<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>biPairKey <span style="color: #000066; font-weight: bold;">in</span> buttonsAndImages<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> image <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span> src<span style="color: #339933;">:</span>buttonsAndImages<span style="color: #009900;">&#91;</span>biPairKey<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> style<span style="color: #339933;">:</span><span style="color: #3366CC;">'margin:3px;'</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>biPairKey<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">image</span> <span style="color: #339933;">=</span> image<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>
For multiple image switching we will use a function named toggle.  In the toggle function we will set the source of the hidden image, start the effect to fade out the visible image and fade in the hidden image, and set a global variable to indicate which div is visible
</p?</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> toggle<span style="color: #009900;">&#40;</span>newSrc<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//stop the current animation if it is running.</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Decide which div to hide and which to show.</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>visibleDiv <span style="color: #339933;">==</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//change the hidden image's source</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;image2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> newSrc<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//fade the visible out and the hidden in.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Set which div is visible.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; visibleDiv <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//change the hidden image's source</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;image1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> newSrc<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//fade the visible out and the hidden in.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Set which div is visible</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; visibleDiv <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Check out the <a href="http://www.sweetvision.com/projects/fade-between-multiple-images-example/">demo of fading multiple images</a> to see this in action. If you want to create a slide show or other implementation of this that automatically switches the images, read through my post on <a href="http://www.sweetvision.com/2007/12/05/using-settimeout-in-objects-with-mootools/">Delay, Periodical and Closures</a>. Below you will find the source of the example:</p>
<p></p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;<br />
&lt;html&gt;<br />
&nbsp; &nbsp; &lt;head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;Untitled Document&lt;/title&gt;<br />
&nbsp; &nbsp; &lt;/head&gt;<br />
&nbsp; &nbsp; &lt;body&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;script type=&quot;text/javascript&quot; src=&quot;js/mootools-release-1.11.js&quot; language=&quot;javascript&quot;&gt;&lt;/script&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> visibleDiv <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> toggle<span style="color: #009900;">&#40;</span>newSrc<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>visibleDiv <span style="color: #339933;">==</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;image2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> newSrc<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; visibleDiv <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;image1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> newSrc<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fx</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Style</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> 2000<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; visibleDiv <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> loadImages<span style="color: #009900;">&#40;</span>buttonsAndImages<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>biPairKey <span style="color: #000066; font-weight: bold;">in</span> buttonsAndImages<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> image <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span> src<span style="color: #339933;">:</span>buttonsAndImages<span style="color: #009900;">&#91;</span>biPairKey<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> style<span style="color: #339933;">:</span><span style="color: #3366CC;">'margin:3px;'</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>biPairKey<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">image</span> <span style="color: #339933;">=</span> image<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> faderInit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//create an object to store the relationship of the buttons to the images.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> buttonsAndImages <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'button1'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image1.jpg'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'button2'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image2.jpg'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'button3'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image3.jpg'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'button4'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'image4.jpg'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImages<span style="color: #009900;">&#40;</span>buttonsAndImages<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;domready&quot;</span><span style="color: #339933;">,</span> faderInit<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;div style=&quot;width:453px&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;button1&quot; style=&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot; onclick=&quot;toggle(this.image.src);&quot;&gt;Image 1&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;button2&quot; style=&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot; onclick=&quot;toggle(this.image.src);&quot;&gt;Image 2&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;button3&quot; style=&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot; onclick=&quot;toggle(this.image.src);&quot;&gt;Image 3&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;button4&quot; style=&quot;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&quot; onclick=&quot;toggle(this.image.src);&quot;&gt;Image 4&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div style=&quot;height:112px;&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;div1&quot; style=&quot;position:absolute; opacity: 0;&quot;&gt;&lt;img id=&quot;image1&quot; src=&quot;image1.jpg&quot; /&gt;&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;div2&quot; style=&quot;position:absolute; opacity: 1;&quot;&gt;&lt;img id=&quot;image2&quot; src=&quot;image2.jpg&quot; /&gt;&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &lt;/body&gt;<br />
&lt;/html&gt;</div></td></tr></tbody></table></div>
<p><map name='google_ad_map_45_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/45?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_45_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=45&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2008%2F12%2F07%2Fhow-to-use-mootools-to-fade-between-multiple-images%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images+http://bit.ly/OlPe2" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images+http://bit.ly/OlPe2" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/&amp;submitHeadline=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/&amp;title=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/&amp;title=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images&amp;link=http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/&amp;title=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/&amp;title=How+to%3A+Use+MooTools+to+Fade+Between+Multiple+Images" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/T8sbO_XeuZI2Z3Mmbs1a0TK4E_0/0/da"><img src="http://feedads.g.doubleclick.net/~a/T8sbO_XeuZI2Z3Mmbs1a0TK4E_0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/T8sbO_XeuZI2Z3Mmbs1a0TK4E_0/1/da"><img src="http://feedads.g.doubleclick.net/~a/T8sbO_XeuZI2Z3Mmbs1a0TK4E_0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/id9neVLmX4Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/</feedburner:origLink></item>
		<item>
		<title>Debug JavaScript in Internet Explorer</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/FLDOfZBPrSg/</link>
		<comments>http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 17:01:58 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[breakpoint]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/</guid>
		<description><![CDATA[If you have ever had the horror of finishing up some complex JavaScript in Firefox, and when you try it in IE you just get a bunch of usless and cryptic errors that all point to the wrong line of code, this article is for you. You can actually get a full debugger for Internet [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever had the horror of finishing up some complex JavaScript in Firefox, and when you try it in IE you just get a bunch of usless and cryptic errors that all point to the wrong line of code, this article is for you. You can actually get a full debugger for Internet Exploerer for free that is about as cabable as debugging Javascript as Firebug is in Firefox.&nbsp; There is no plugin or addon for IE that will give you a firebug like experience, but with a little extra downloading and work you can get a setup that will allow you to set break points and inspect objects in JavaScript applications in IE.&nbsp; First thing you will need to download the free <a title="Visual Web Developer" target="_blank" href="http://www.microsoft.com/express/download/#webInstall" id="xp_c">Visual Web Developer Express</a> IDE from Microsoft Visual Web Developer is like Firebug for Internet Explorer, only it is not an addon and you have to do a bunch of setup befure it will be useful.&nbsp; It is free but it will cost you more than 200 megs of hard drive space and about an hour of downloading and installing.</p>
<p>Once you have Visual Web Developer Express installed launch the IDE and create a new blank web site:<br />
File &gt;&gt; New Web Site<br />
Select &#8220;Empty Web Site&#8221; and give the project a name and click OK.</p>
<p>If your default web browser is something other than IE you will need to setup Visual Web Developer do debug in Internet Explorer by default.</p>
<p>On the right side of the IDE you will find the Solution Exploerer, right click on your solution and select &#8220;Browse With&#8221;.&nbsp; In the browse with window select Internet Explorer and click the Set as Default button.&nbsp; This will not change your system default browser just the browser that will be used by this solution by default.&nbsp; Once you have IE set as default for the solution you can click cancel.</p>
<p><br />
<br />
Now you need to make sure IE is ready to be debugged.&nbsp; Open Internet Explorer, click on Tools &gt;&gt; Options, select the Advanced tab and remove the check from &#8220;Disable Script Debugging (Internet Explorer)&#8221; and click OK.</p>
<p>Now you are ready.&nbsp; Switch back to Visual Web Developer and press F5 to start debugging.&nbsp; If this is the first time you have launched this solution Visual Web Developer may display a dialog stating that a web.config could not be found.&nbsp; If you recieve this dialog choose &#8220;Add a new web.config&#8230;&#8221; and click ok. This should launch Internet Explorer with an error page, just type in the URL of the page you want to debug in the address bar.&nbsp; Once the page loads if you switch back to Visual Web Developer Express you will see all of the files loaded by the page in the Solution Explorer on the right.&nbsp; Double click the file with the JavaScript you wish to debug, which will open the file in the IDE.&nbsp; You can now set break points where you want them.&nbsp; Once you have your break points set switch back to IE and take the action that will execute the code you are debugging and Visual Web developer will stop on your break points letting you inspect the objects and variables at that point.</p>
<p>To make the process easier you can right click on the solution in the solution explorer and select &#8220;Add New Item&#8221;.&nbsp; From the presented installed templates choose &#8220;HTML Page&#8221;, and name it index.htm.&nbsp; In the head of the generated HTML add a meta refresh to go to the page you wish to debug. e.g. &lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0;url=http://www.yourdomain.com/pagetodebug.html&#8221; /&gt;.&nbsp; After adding that when you debug it will automatically redirect to the page you are working on.</p>
<p><map name='google_ad_map_44_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/44?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_44_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=44&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2008%2F12%2F02%2Fdebug-javascript-in-internet-explorer%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=Debug+JavaScript+in+Internet+Explorer+http://bit.ly/16v5Sx" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=Debug+JavaScript+in+Internet+Explorer+http://bit.ly/16v5Sx" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/&amp;submitHeadline=Debug+JavaScript+in+Internet+Explorer" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/&amp;title=Debug+JavaScript+in+Internet+Explorer" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/&amp;title=Debug+JavaScript+in+Internet+Explorer" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Debug+JavaScript+in+Internet+Explorer&amp;link=http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/&amp;title=Debug+JavaScript+in+Internet+Explorer" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/&amp;title=Debug+JavaScript+in+Internet+Explorer" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/MKoPPliPydHw2kKbceaApSIli4E/0/da"><img src="http://feedads.g.doubleclick.net/~a/MKoPPliPydHw2kKbceaApSIli4E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/MKoPPliPydHw2kKbceaApSIli4E/1/da"><img src="http://feedads.g.doubleclick.net/~a/MKoPPliPydHw2kKbceaApSIli4E/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/FLDOfZBPrSg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2008/12/02/debug-javascript-in-internet-explorer/</feedburner:origLink></item>
		<item>
		<title>Using MooTools to fade between two images</title>
		<link>http://feedproxy.google.com/~r/Sweetvision/~3/NSrlfxsOydM/</link>
		<comments>http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 12:00:45 +0000</pubDate>
		<dc:creator>Kelly Anderson</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[fade]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/</guid>
		<description><![CDATA[Fading between two images is actually a fairly simple task with MooTools.  The first thing you need to do is setup up two DIV tags that are absolutely positioned over one another inside another DIV tag that uses default placement.  Then you place your image tags inside each of the absolutely positioned DIV [...]]]></description>
			<content:encoded><![CDATA[<p>Fading between two images is actually a fairly simple task with MooTools.  The first thing you need to do is setup up two DIV tags that are absolutely positioned over one another inside another DIV tag that uses default placement.  Then you place your image tags inside each of the absolutely positioned DIV tags.  Each of the DIV tags needs to have an id attribute so they can be referenced in your javascript code.</p>
<p>The HTML for the task will look like this:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;pre&gt;<br />
&amp;lt;div style=&quot;height:112px;&quot; &amp;gt;<br />
&nbsp; &nbsp; &amp;lt;div id=&quot;div1&quot; style=&quot;position:absolute; opacity: 0;&quot;&amp;gt;&amp;lt;img id=&quot;image1&quot; src=&quot;image1.jpg&quot; /&amp;gt;&amp;lt;/div&amp;gt;<br />
&nbsp; &nbsp; &amp;lt;div id=&quot;div2&quot; style=&quot;position:absolute; opacity: 1;&quot;&amp;gt;&amp;lt;img id=&quot;image2&quot; src=&quot;image2.jpg&quot; /&amp;gt;&amp;lt;/div&amp;gt;<br />
&amp;lt;/div&amp;gt;<br />
&lt;/pre&gt;</div></td></tr></tbody></table></div>
<p>This gives you two DIV tags that will stack on top of one another but the DIV they are inside of will flow with the page. One of the DIV tags starts with an opacity of zero and the other with an opacity of one.</p>
<p></p>
<p>Next you will need a way to make one image disappear and the other appear.  We do this by using the MooTools effects.  MooTools allows you to animate the change of a style from one value to the next.  The easiest way to do this is to use the effect member available on any element accessed with MooTools.  To transition from one image to the other smoothly we animate the opacity of each DIV element in opposite directions one becoming fully opaque and the other becoming fully transparent.  We do that with the following function:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;pre&gt;<br />
function show(whichOne){<br />
&nbsp; &nbsp; if(whichOne == 1){<br />
&nbsp; &nbsp; &nbsp; &nbsp; tDiv = &quot;div1&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vDiv = &quot;div2&quot;;<br />
&nbsp; &nbsp; }else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; tDiv = &quot;div2&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vDiv = &quot;div1&quot;;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; if($(tDiv).fx){$(tDiv).fx.stop();}<br />
&nbsp; &nbsp; if($(vDiv).fx){$(vDiv).fx.stop();}<br />
&nbsp; &nbsp; $(tDiv).fx = $(tDiv).effect('opacity', {duration: 2000}).start(0);<br />
&nbsp; &nbsp; $(vDiv).fx = $(vDiv).effect('opacity', {duration: 2000}).start(1);<br />
}<br />
&lt;/pre&gt;</div></td></tr></tbody></table></div>
<p>First you decide which DIV tag will become Transparent and which one will be visible.  Next there are two lines of code to check for an active animation and stop any animations that are already running, before we start some new animations.  The last two lines create an animation attached to each DIV, going from the current opacity to the specified Opacity, and sets the animation object to the DIV tags .fx member. See the full code below or <a href="http://www.sweetvision.com/projects/fade-between-two-images-example/">check out the example</a>.</p>
<p><textarea style="width:550px; height:350px;" wrap="off"><br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;/js/mootools-release-1.11.js&#8221; language=&#8221;javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221;&gt;<br />
function show(whichOne){<br />
	if(whichOne == 1){<br />
		tDiv = &#8220;div1&#8243;;<br />
		vDiv = &#8220;div2&#8243;;<br />
	}else{<br />
		tDiv = &#8220;div2&#8243;;<br />
		vDiv = &#8220;div1&#8243;;<br />
	}<br />
	if($(tDiv).fx){$(tDiv).fx.stop();}<br />
	if($(vDiv).fx){$(vDiv).fx.stop();}<br />
	$(tDiv).fx = $(tDiv).effect(&#8217;opacity&#8217;, {duration: 2000}).start(0);<br />
	$(vDiv).fx = $(vDiv).effect(&#8217;opacity&#8217;, {duration: 2000}).start(1);<br />
}<br />
&lt;/script&gt;<br />
&lt;div style=&#8221;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&#8221; onclick=&#8221;show(1);&#8221;&gt;Show 1&lt;/div&gt;<br />
&lt;div style=&#8221;background-color:#aaaaaa; border: 1px solid #444; cursor: pointer;&#8221; onclick=&#8221;show(2);&#8221;&gt;Show 2&lt;/div&gt;<br />
&lt;div style=&#8221;height:112px;&#8221;&gt;<br />
	&lt;div id=&#8221;div1&#8243; style=&#8221;position:absolute; opacity: 0;&#8221;&gt;&lt;img id=&#8221;image1&#8243; src=&#8221;http://www.sweetvision.com/wordpress/wp-content/uploads/2008/03/image1.jpg&#8221; /&gt;&lt;/div&gt;<br />
	&lt;div id=&#8221;div2&#8243; style=&#8221;position:absolute; opacity: 1;&#8221;&gt;&lt;img id=&#8221;image2&#8243; src=&#8221;http://www.sweetvision.com/wordpress/wp-content/uploads/2008/03/image2.jpg&#8221; /&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
</textarea><br />
</code></p>
<p>Update: By popular demand I have created an new post that covers fading multiple images here: <a href="http://www.sweetvision.com/2008/12/07/how-to-use-mootools-to-fade-between-multiple-images/">How to: Use MooTools to Fade Between Multiple Images</a></p>
<p><map name='google_ad_map_43_b61080c23107b439'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/43?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_43_b61080c23107b439' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=43&amp;url= http%3A%2F%2Fwww.sweetvision.com%2F2008%2F03%2F17%2Fusing-mootools-to-fade-between-two-images%2F' /></p><p align="left"><a class="tt" href="http://twitter.com/home/?status=Using+MooTools+to+fade+between+two+images+http://bit.ly/INead" title="Post to Twitter"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="[Post to Twitter]" border="0" /></a>&nbsp; <a class="tt" href="http://plurk.com/?status=Using+MooTools+to+fade+between+two+images+http://bit.ly/INead" title="Post to Plurk"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-plurk-big3.png" alt="[Post to Plurk]" border="0" /></a>&nbsp; <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/&amp;submitHeadline=Using+MooTools+to+fade+between+two+images" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-buzz-big3.png" alt="[Post to Yahoo Buzz]" border="0" /></a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/&amp;title=Using+MooTools+to+fade+between+two+images" title="Post to Delicious"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="[Post to Delicious]" border="0" /></a>&nbsp; <a class="tt" href="http://digg.com/submit?url=http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/&amp;title=Using+MooTools+to+fade+between+two+images" title="Post to Digg"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="[Post to Digg]" border="0" /></a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Using+MooTools+to+fade+between+two+images&amp;link=http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/" title="Post to Ping.fm"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-ping-big3.png" alt="[Post to Ping.fm]" border="0" /></a>&nbsp; <a class="tt" href="http://reddit.com/submit?url=http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/&amp;title=Using+MooTools+to+fade+between+two+images" title="Post to Reddit"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="[Post to Reddit]" border="0" /></a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/&amp;title=Using+MooTools+to+fade+between+two+images" title="Post to StumbleUpon"><img class="nothumb" src="http://www.sweetvision.com/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="[Post to StumbleUpon]" border="0" /></a>&nbsp; </p>
<p><a href="http://feedads.g.doubleclick.net/~a/mMMPz68Ty7cVUweqKq9qLce5ZzY/0/da"><img src="http://feedads.g.doubleclick.net/~a/mMMPz68Ty7cVUweqKq9qLce5ZzY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mMMPz68Ty7cVUweqKq9qLce5ZzY/1/da"><img src="http://feedads.g.doubleclick.net/~a/mMMPz68Ty7cVUweqKq9qLce5ZzY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Sweetvision/~4/NSrlfxsOydM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.sweetvision.com/2008/03/17/using-mootools-to-fade-between-two-images/</feedburner:origLink></item>
	</channel>
</rss>
