<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Weneck.com &#187; Javascript</title>
	<atom:link href="http://weneck.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://weneck.com</link>
	<description>Rusty Weneck&#039;s little corner of the interweb.</description>
	<lastBuildDate>Thu, 01 Dec 2011 13:50:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Prototype Image Flip</title>
		<link>http://weneck.com/2011/10/06/prototype-image-flip/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=prototype-image-flip</link>
		<comments>http://weneck.com/2011/10/06/prototype-image-flip/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 22:17:03 +0000</pubDate>
		<dc:creator>Rusty Weneck</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[image flip]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[Script.aculo.us]]></category>

		<guid isPermaLink="false">http://weneck.com/?p=20</guid>
		<description><![CDATA[I found a great Javascript image flip function over at Webmuch and wanted to use it, problem was it was only implemented in JQuery. I was using Prototype and script.aculo.us, so I ported it over. I ended up not using it, but for future reference I&#8217;ll preserve it here. Enjoy. //adapted from a jQuery flip [...]]]></description>
			<content:encoded><![CDATA[<p>I found a great Javascript image flip function over at <a href="http://webmuch.com/image-flip-using-jquery/">Webmuch</a> and<br />
wanted to use it, problem was it was only implemented in <a href="http://jquery.com/">JQuery</a>. I was using <a href="http://www.prototypejs.org/">Prototype</a> and <a href="http://script.aculo.us/">script.aculo.us</a>, so I ported it<br />
over. I ended up not using it, but for future reference I&#8217;ll preserve<br />
it here. Enjoy.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">//adapted from a jQuery flip function found here.
//http://webmuch.com/image-flip-using-jquery/
var tweenDuration = 0.5;
&nbsp;
//get the image elements.
var image1 = $('theFirstImage');
var image2 = $('theSecondImage');
&nbsp;
//set up the flip function
image1.observe( 'click', function(event){
       //set the heights so that the images do-not scale with the
widths (if not explicitly set)
       image1.height = image1.height;
       image2.height = image2.height;
&nbsp;
       var halfWidth = image1.width/2;
&nbsp;
       image2.setStyle({marginLeft: halfWidth});
       image2.width = 0;
&nbsp;
       new Effect.Tween(image1, 250, 0, {duration: tweenDuration}, 'width');
       new Effect.Tween(image1, 0, halfWidth, {duration:
tweenDuration}, function(p){image1.setStyle({marginLeft: p})});
       window.setTimeout(
               function(){
                   new Effect.Tween(image2, 0, 250, {duration:
tweenDuration}, 'width');
                   new Effect.Tween(image2, halfWidth, 0, {duration:
tweenDuration}, function(p){image2.setStyle({marginLeft: p})});
               }
               , tweenDuration*1000);
   }
);
image2.observe( 'click', function(event){
       image2.height = image2.height;
       image1.height = image1.height;
&nbsp;
       var halfWidth = image2.width/2;
&nbsp;
       image1.setStyle({marginLeft: halfWidth});
       image1.width = 0;
&nbsp;
       new Effect.Tween(image2, 250, 0, {duration: tweenDuration}, 'width');
       new Effect.Tween(image2, 0, halfWidth, {duration:
tweenDuration}, function(p){image2.setStyle({marginLeft: p})});
       window.setTimeout(
               function(){
                   new Effect.Tween(image1, 0, 250, {duration:
tweenDuration}, 'width');
                   new Effect.Tween(image1, halfWidth, 0, {duration:
tweenDuration}, function(p){image1.setStyle({marginLeft: p})});
               }
               , tweenDuration*1000);
   }
);</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://weneck.com/2011/10/06/prototype-image-flip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

