<?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>Lateral Code &#187; javascript</title>
	<atom:link href="http://www.lateralcode.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lateralcode.com</link>
	<description>A Web Development Blog Focused on Code and Technology</description>
	<lastBuildDate>Fri, 15 Jul 2011 03:00:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>JavaScript Fade Effect without Libraries</title>
		<link>http://www.lateralcode.com/javascript-fade-effect/</link>
		<comments>http://www.lateralcode.com/javascript-fade-effect/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 00:29:11 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1727</guid>
		<description><![CDATA[Using JavaScript libraries like jQuery and Mootools does simplify your code, but this comes with the price of an added footprint. Often times, the same effects can be accomplished in raw JavaScript with little to no hassle. Indeed, this tutorial will explain how to create the classic fade effect without resorting to jQuery or Mootools. [...]]]></description>
			<content:encoded><![CDATA[<p>Using JavaScript libraries like jQuery and Mootools does simplify your code, but this comes with the price of an added footprint. Often times, the same effects can be accomplished in raw JavaScript with little to no hassle. Indeed, this tutorial will explain how to create the classic fade effect without resorting to jQuery or Mootools.</p>
<p><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-fade-effect/2.jpg" alt="Fade" class="list-post-img"/></p>
<p>The fade effect, as its name denotes, is an animation used to fade an element off of a page. You can find a demo of it in the <a href="http://api.jquery.com/fadeOut/#example-0">jQuery documentation</a>.</p>
<p><span id="more-1727"></span></p>
<p>To begin, let&#8217;s create a <code>fade</code> function that accepts a DOM element and a time as parameters:</p>
<pre><code>function fade( elem, time )</code></pre>
<p>To achieve the fade effect, we can use the CSS opacity property, which determines the transparency of an element. Setting the opacity to 1 means the object is fully visible. As the value lowers, so too does the transparency. Consequently, 0 represents a completely invisible element.</p>
<p>Our logic will roughly abide by the following outline:</p>
<ol>
<li>Find the starting opacity of <code>elem</code>, the given element. This is the value we have to reduce to 0 in <code>time</code>, the given number of milliseconds.</li>
<li>Begin an asynchronous recursion loop that runs every 100 milliseconds.</li>
<li>In the loop, decrement the opacity by the correct fraction to ensure that in <code>time</code> milliseconds, <code>elem</code> has an opacity of 0.</li>
</ol>
<p>The correct fraction noted in step 3 will be equal to the starting opacity divided by <code>time</code> / 100. This is because the loop will go through <code>time</code> / 100 iterations in <code>time</code> milliseconds. In each iteration, the opacity must be decremented by the starting opacity / ( <code>time</code> / 100 ) to ensure that it will end up as 0 (the total decrement will equal the starting opacity) after the loop finishes its execution.</p>
<p>Let&#8217;s write some preliminary code based off this outline:</p>
<pre><code>function fade( elem, time )
{
	var startOpacity = elem.style.opacity || 1;
	elem.style.opacity = startOpacity;

	(function go() {
		elem.style.opacity -= startOpacity / ( time / 100 );
		setTimeout( go, 100 );
	})();
}</code></pre>
<p>Note that <code>startOpacity</code> is assigned to 1 if <code>elem.style.opacity</code> is not explicitly set. This explains why we have to set <code>elem.style.opacity</code> in the following line, as it may not be defined.</p>
<p>After finding the opacity, the <code>go</code> function is recursively called as per our specifications. In the code&#8217;s current state, however, it does not stop. To determine when it should finish executing, we have to check whether the element has faded. This can be done by monitoring its opacity in relation to the target value, or 0:</p>
<pre><code>if( elem.style.opacity > 0 )
	setTimeout( go, 100 );
else
	elem.style.display = 'none';</code></pre>
<p>Not only do we stop calling <code>go</code> when we&#8217;re done, but we also set the display to none so that other elements are repositioned; <code>elem</code> should not continue to take up page space after it has faded. This is the typical functionality of JavaScript libraries and applies to our code as well.</p>
<p>To ice our cake by making the code compatible with IE, we can use the filter property:</p>
<pre><code>elem.style.filter = 'alpha(opacity=' + elem.style.opacity * 100 + ')';</code></pre>
<p>The final code is included below:</p>
<pre><code>function fade( elem, time )
{
	var startOpacity = elem.style.opacity || 1;
	elem.style.opacity = startOpacity;

	(function go() {
		elem.style.opacity -= startOpacity / ( time / 100 );

		// for IE
		elem.style.filter = 'alpha(opacity=' + elem.style.opacity * 100 + ')';

		if( elem.style.opacity > 0 )
			setTimeout( go, 100 );
		else
			elem.style.display = 'none';
	})();
}</code></pre>
<p>And that&#8217;s it! See you next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/javascript-fade-effect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Use the new Google Maps API! Part 2</title>
		<link>http://www.lateralcode.com/new-google-maps-api-2/</link>
		<comments>http://www.lateralcode.com/new-google-maps-api-2/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 19:33:30 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1600</guid>
		<description><![CDATA[A few days ago, our experiments with the Google Maps API resulted in static images of various locations. Today, these same experiments will continue in a new medium: JavaScript. As we expand our knowledge of the API, we&#8217;ll cover the creation of a dynamic map, fully equipped with both movement and zooming. View the Demo [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, <a href="http://www.lateralcode.com/new-google-maps-api/">our experiments with the Google Maps API</a> resulted in static images of various locations. Today, these same experiments will continue in a new medium: JavaScript. As we expand our knowledge of the API, we&#8217;ll cover the creation of a dynamic map, fully equipped with both movement and zooming.</p>
<p><img src="http://www.lateralcode.com/wp-content/uploads2/new-google-maps-api-2/1.jpg" alt="Maps" class="list-post-img"/></p>
<p><a class="view" href="http://demo.lateralcode.com/new-google-maps-api-2/">View the Demo</a> <a class="dl" href="http://www.lateralcode.com/wp-content/uploads2/new-google-maps-api-2/new-google-maps-api-2.zip">Download the Files</a></p>
<p><span id="more-1600"></span></p>
<p>To begin our mad science, we&#8217;ll first need to include the API itself (note the HTML 5 that omits the <code>type</code> attribute of the <code>script</code> tag):</p>
<pre><code>&lt;!-- sensor=false tells google images we aren't trying to sense the user's location --&gt;
&lt;script src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;</code></pre>
<p>Moving forward, we&#8217;ll create a function which, when given an address, will display a dynamic map centered on it. Dutifully called <code>setMapAddress</code>, the function will have the following container:</p>
<pre><code>function setMapAddress( address )
{
	// code goes here
}</code></pre>
<p>To specify a location, Google Maps requires a latitude and longitude. As a result, our first task will be to convert the given <code>address</code> into the necessary format. Of course, this process has it&#8217;s own scientific term: geocoding. Being both scientifically and technologically-savvy, Google does the work for us in their <code>Geocoder</code> object. All we need to do is instantiate one and subsequently call its <code>geocode</code> method:</p>
<pre><code>var geocoder = new google.maps.Geocoder();

geocoder.geocode( { address : address }, function( results, status ) {

} );</code></pre>
<p>The geocode method requires, as arguments, an object as well as a callback function. Looking at the first parameter, <code>{ address : address }</code>, may strike initial confusion. The first use of the word <code>address</code> refers to a property of the object. On the contrary, the second use refers to the variable passed into the <code>setMapAddress</code> function, which we are trying to geocode.</p>
<p>Once the geocoding finishes, the callback function is invoked with a <code>results</code> array and <code>status</code> that is used to determine success. If the <code>status</code> notes a successful geocode, we&#8217;ll have to get the location (latitude/longitude) from the <code>results</code> array, setup options (similar to the options for the static images in the previous article), and finally construct the map. In its completed form, the callback function is:</p>
<pre><code>if( status == google.maps.GeocoderStatus.OK ) {
	var latlng = results[0].geometry.location;
	var options = {
		zoom: 8,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};

	new google.maps.Map( document.getElementById( 'map' ), options );
}</code></pre>
<p>The <code>options</code> object specifies the zoom, center, and type of the resultant map. In this case, these have been set to 8, the given address converted to a latitude/longitude, and road map respectively.</p>
<p>In addition, note that the constructor requires a DOM element and the aforementioned options. This means we&#8217;ll have to create the element, which has an <code>id</code> of <code>map</code>.</p>
<pre><code>&lt;div id="map"&gt;&lt;/div&gt;</code></pre>
<p><code>#map</code> also needs a defined width and height:</p>
<pre><code>#map {
	width: 512px;
	height: 512px;
}</code></pre>
<p>Last, but certainly not least, we have to call the <code>setMapAddress</code> function we recently finished:</p>
<pre>setMapAddress( "Chicago, IL" );</pre>
<p>Voila! That&#8217;s all we need for a functioning dynamic map. You can <a href="http://demo.lateralcode.com/new-google-maps-api-2/">view the demo</a> or <a href="http://www.lateralcode.com/wp-content/uploads2/new-google-maps-api-2/new-google-maps-api-2.zip">download the files</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/new-google-maps-api-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Elegant jQuery Slideshow Plugin: Lateral Slider</title>
		<link>http://www.lateralcode.com/lateral-slider/</link>
		<comments>http://www.lateralcode.com/lateral-slider/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 03:44:57 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1541</guid>
		<description><![CDATA[Let&#8217;s start with the defintion: Slider &#8211; The easiest known way to showcase your images and photos on the web in style. Who can deny it? This is the generation of web 2.0 sliders. A few JavaScript files, some CSS, and a bit of markup is all you need to generate an elegant showcase of [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s start with the defintion:</p>
<p>Slider &#8211; The easiest known way to showcase your images and photos on the web in style.</p>
<p>Who can deny it? This is the generation of web 2.0 sliders. A few JavaScript files, some CSS, and a bit of markup is all you need to generate an elegant showcase of your images. Best part? 99% of it is <strong>done for you</strong>.</p>
<p><img src="http://www.lateralcode.com/wp-content/uploads2/lateral-slider/1.jpg" alt="Lateral Slider" class="list-post-img"/></p>
<p>Well, that&#8217;s the ideal situation. Unfortunately, it&#8217;s often times much more complicated. That&#8217;s why I created <a href="http://codecanyon.net/item/lateral-slider-jquery-plugin-with-13-transitions/109908?ref=nviswan10">Lateral Slider</a>.</p>
<p><a class="view" href="http://codecanyon.net/item/lateral-slider-jquery-plugin-with-13-transitions/full_screen_preview/109908?ref=nviswan10">View the Demo</a><a class="dl" href="http://codecanyon.net/item/lateral-slider-jquery-plugin-with-13-transitions/109908?ref=nviswan10">Purchase it from CodeCanyon</a></p>
<p><span id="more-1541"></span></p>
<p>Lateral Slider is a jQuery slideshow plugin that I recently released on <a href="http://codecanyon.net/?ref=nviswan10">CodeCanyon</a>. How does it work? Simple.</p>
<h2>1. Include the CSS/JavaScript</h2>
<p>CSS:</p>
<pre>&lt;link rel="stylesheet" href="slider.css" type="text/css" media="screen" /&gt;</pre>
<p>JavaScript:</p>
<pre>&lt;!-- jQuery --&gt;
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;&lt;/script&gt;

&lt;!-- Lateral Slider --&gt;
&lt;script src=&quot;slider.jquery.js&quot;&gt;&lt;/script&gt;</pre>
<h2>2. Write the Markup</h2>
<p>All you&#8217;ll need is a div and a few images:</p>
<pre>&lt;div id=&quot;slider&quot;&gt;
	&lt;img src=&quot;image1.jpg&quot; alt=&quot;Image 1&quot; /&gt;
	&lt;img src=&quot;image2.jpg&quot; alt=&quot;Image 2&quot; /&gt;
	&lt;img src=&quot;image3.jpg&quot; alt=&quot;Image 3&quot; /&gt;
&lt;/div&gt;</pre>
<h2>3. Activate Lateral Slider</h2>
<pre>&lt;!-- no need for type="text/javascript" in HTML 5 --&gt;
&lt;script&gt;$( '#slider' ).lateralSlider();&lt;/script&gt;</pre>
<h2>4. Celebrate</h2>
<p>Lateral Slider is ready to be displayed.</p>
<h2>5. Oops, was there supposed to be a fifth step?</h2>
<p>Nope. You&#8217;re done.</p>
<h2>Features</h2>
<p>Simple setup is great, but I&#8217;m sure you&#8217;re also looking for features. Fear not:</p>
<ul>
<li>13 different transitions</li>
<li>Support for all major browsers (including IE6)</li>
<li>Image linking</li>
<li>Many configurable options</li>
<li>Controls (forward, back, pick a slide)</li>
<li>Comprehensive documentation</li>
<li>Much more&#8230;</li>
</ul>
<p>Want to know more? Check out the <a href="http://codecanyon.net/item/lateral-slider-jquery-plugin-with-13-transitions/109908?ref=nviswan10">description at CodeCanyon</a>. Better yet, why don&#8217;t you take a look at the <a href="http://codecanyon.net/item/lateral-slider-jquery-plugin-with-13-transitions/full_screen_preview/109908?ref=nviswan10">live preview</a> and see Lateral Slider for yourself.</p>
<h2>Purchase It!</h2>
<p>Interested? It&#8217;s only $10. Why not <a href="http://codecanyon.net/item/lateral-slider-jquery-plugin-with-13-transitions/109908?ref=nviswan10">purchase it from CodeCanyon</a>? <img src='http://www.lateralcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/lateral-slider/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>5 Must-Reads on JavaScript Inheritance</title>
		<link>http://www.lateralcode.com/javascript-inerhitance/</link>
		<comments>http://www.lateralcode.com/javascript-inerhitance/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 00:01:06 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1507</guid>
		<description><![CDATA[Do you know inheritance in JavaScript? Do you truly understand how it works? Are you aware that JavaScript uses a prototypal inheritance scheme that is often disfavored or disliked? Have you used a script on the web to adapt this scheme to classical inheritance? In these past few days, I&#8217;ve been writing a jQuery slider [...]]]></description>
			<content:encoded><![CDATA[<p>Do you know inheritance in JavaScript? Do you <em>truly understand</em> how it works? Are you aware that JavaScript uses a prototypal inheritance scheme that is often disfavored or disliked? Have you used a script on the web to adapt this scheme to classical inheritance?</p>
<p><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-inheritance/1.jpg" alt="Read" class="list-post-img"/></p>
<p>In these past few days, I&#8217;ve been writing a jQuery slider plugin with various transition effects. To make the code succinct, I decided to use a base Transition object that other objects, which define a specific type of transition, inherit from. This led me to the question of JavaScript inheritance. </p>
<p>Inheritance in JavaScript has been a controversial subject. Should a standard be set to use classical inheritance or should the base prototypal system be favored? Both paths have their own advantages and disadvantages. The readings listed below will hopefully give you enough information to choose which method you want to use.</p>
<p><span id="more-1507"></span></p>
<h2>1. <a href="http://javascript.crockford.com/private.html">Private Members in JavaScript</a></h2>
<p>This reading isn&#8217;t <em>really</em> about inheritance, but it&#8217;s an important primer on object-oriented programming in JavaScript which will help give you a deeper understand of what is to come.</p>
<p><a href="http://javascript.crockford.com/private.html"><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-inheritance/inheritance1.png" alt="Private Members in JavaScript" class="list-post-img"/></a></p>
<h2>2. <a href="http://ejohn.org/blog/simple-javascript-inheritance/">Simple JavaScript Inheritance</a></h2>
<p>John Resig, the creator of the jQuery JavaScript library, presents his own take on inheritance. Using his utility, it&#8217;s possible to change JavaScript into more of a classical inheritance scheme.</p>
<p><a href="http://ejohn.org/blog/simple-javascript-inheritance/"><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-inheritance/inheritance2.png" alt="Simple JavaScript Inheritance" class="list-post-img"/></a></p>
<h2>3. <a href="http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures">JavaScript Inheritance via Prototypes and Closures</a></h2>
<p>Steffen Rusitschka explains the advantages and disadvantages of prototype-based and closure-based (more classical) inheritance. He also presents his own derivative of Resig&#8217;s script.</p>
<p><a href="http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures"><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-inheritance/inheritance3.png" alt="JavaScript Inheritance via Prototypes and Closures" class="list-post-img"/></a></p>
<h2>4. <a href="http://www.crockford.com/javascript/inheritance.html">Classical Inheritance in JavaScript</a></h2>
<p>This reading, by Douglas Crockford, a well-known JavaScript developer, is yet another way to achieve the classical inheritance scheme in JavaScript. In addition to presenting his extension, Crockford also explains the added functionality that JavaScript can provide.</p>
<p><a href="http://www.crockford.com/javascript/inheritance.html"><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-inheritance/inheritance4.png" alt="Classical Inheritance in JavaScript" class="list-post-img"/></a></p>
<h2>5. <a href="http://javascript.crockford.com/prototypal.html">Prototypal Inheritance in JavaScript</a></h2>
<p>In this reading, Crockford analyzes his old classical inheritance and realizes the benefits of sticking with the prototypal structure. This last article expresses the flip side of the controversy, explaining why there is no need for a classical inheritance scheme. </p>
<p><a href="http://javascript.crockford.com/prototypal.html"><img src="http://www.lateralcode.com/wp-content/uploads2/javascript-inheritance/inheritance5.png" alt="Prototypal Inheritance in JavaScript" class="list-post-img"/></a></p>
<p>Hopefully, these links have shed light on the debate between prototypal inheritance and classical inheritance. Although I used Resig&#8217;s script in my slider plugin, I recently came across Crockford&#8217;s prototypal inheritance article (#5) and am now rethinking my ways for future projects.</p>
<p>So, what&#8217;s your take on JavaScript inheritance? Leave a comment below. I would be glad to hear more arguments for either side!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/javascript-inerhitance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Want an Effective, Customizable Image Slider? Consider Nivo Slider</title>
		<link>http://www.lateralcode.com/nivo-slider/</link>
		<comments>http://www.lateralcode.com/nivo-slider/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 00:12:14 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1455</guid>
		<description><![CDATA[Image sliders, once rarely found on websites, have become a new trend of web design. Indeed, they are present on free XHTML/CSS themes all the way up to commercial templates on sites like themeforest. Unfortunately, with this trend, many convoluted scripts aimed at providing easy sliders are now available on the web. They often times [...]]]></description>
			<content:encoded><![CDATA[<p>Image sliders, once rarely found on websites, have become a new trend of web design. Indeed, they are present on free XHTML/CSS themes all the way up to commercial templates on sites like <a href="http://themeforest.com">themeforest</a>. Unfortunately, with this trend, many convoluted scripts aimed at providing easy sliders are now available on the web. They often times have complex, barely-documented installation and usage that makes it hard to integrate into modern websites.</p>
<p><a href="http://nivo.dev7studios.com/"><img src="http://www.lateralcode.com/wp-content/uploads2/nivo-slider/1.png" alt="Nivo Slider" class="list-post-img"/></a></p>
<p>Recently, I ran into this exact problem when finishing one of my XHTML/CSS templates. I couldn&#8217;t find a simple, effective slider that was easy to use, simple to style, and a breeze to get working. Luckily, after enough searching, I came across <a href="http://nivo.dev7studios.com/">Nivo Slider</a>, and my problems were solved.</p>
<p><span id="more-1455"></span></p>
<p>Nivo Slider is a 7 KB (compressed) jQuery plugin that provides a simple and intuitive way of creating sliders. With various transition effects, settings, general features, and great browser support, it beats out the competition. Unlike many other scripts, Nivo Slider&#8217;s instructions come on a <strong>single page</strong> and, more importantly, are easy to follow. No searching required.</p>
<p>Other than including the CSS/JS files, all it took to get a Nivo Slider working on my theme was this HTML:</p>
<pre>&lt;div id=&quot;slider&quot;&gt;
	&lt;img src=&quot;slider/slide1.jpg&quot; alt=&quot;Slide 1&quot; title=&quot;Post 1&quot; /&gt;
	&lt;img src=&quot;slider/slide2.jpg&quot; alt=&quot;Slide 2&quot; title=&quot;Post 2&quot; /&gt;
	&lt;img src=&quot;slider/slide3.jpg&quot; alt=&quot;Slide 3&quot; title=&quot;Post 3&quot; /&gt;
	&lt;img src=&quot;slider/slide4.jpg&quot; alt=&quot;Slide 4&quot; title=&quot;Post 4&quot; /&gt;
	&lt;img src=&quot;slider/slide5.jpg&quot; alt=&quot;Slide 5&quot; title=&quot;Post 5&quot; /&gt;
&lt;/div&gt;</pre>
<p>and this JavaScript:</p>
<pre>$( '#slider' ).nivoSlider();</pre>
<p>How much more can you ask for? Even if the plain, default theme isn&#8217;t enough, styling is a breeze! Not only that, but if the slider styling on the <a href="http://nivo.dev7studios.com/">front page</a> is exactly what you&#8217;re looking for, there is even a <a href="http://dev7studios.com/downloads/5">style pack</a> that you can download. </p>
<p>The only slight concern you may have with the script is the lack of support for IE6. Since I&#8217;m not interested in supporting this ancient browser anymore, this wasn&#8217;t too big an issue for me. Nevertheless, the use of IE6 is steadily decreasing and, with all of its features and advantages, <a href="http://nivo.dev7studios.com/">Nivo Slider</a> is certainly a good choice for an effective, customizable image slider.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/nivo-slider/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Easily Combine JavaScript Files With JMerge</title>
		<link>http://www.lateralcode.com/combine-javascript-jmerge/</link>
		<comments>http://www.lateralcode.com/combine-javascript-jmerge/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 13:00:22 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1353</guid>
		<description><![CDATA[Looking back at the 2009 year, it is evident that JavaScript has played a big role in web design. Using libraries such as jQuery and MooTools, one can easily apply advanced effects with ease. Indeed, JavaScript is now present on almost every website. With the rise of this new beast comes a few issues. The [...]]]></description>
			<content:encoded><![CDATA[<p>Looking back at the 2009 year, it is evident that JavaScript has played a big role in web design. Using libraries such as <a href="http://jquery.com">jQuery</a> and <a href="http://mootools.net/">MooTools</a>, one can easily apply advanced effects with ease. Indeed, JavaScript is now present on almost every website.</p>
<p><img src="http://lateralcode.com/wp-content/uploads/jmerge/4.jpg" alt="JavaScript Growth" class="list-post-img" /></p>
<p>With the rise of this new beast comes a few issues. The biggest libraries out there aren&#8217;t too small in terms of code size. Each one can add significantly to load time even when minified. Another problem resides with extra HTTP requests; each new file is accompanied by an extra request. Ultimately, this once again leads directly to a larger wait for users.</p>
<p><span id="more-1353"></span></p>
<p>Although the first problem can&#8217;t be solved simply, reducing HTTP requests is a trivial task; just combine all of your JavaScript into one file. Unfortunately, sometimes it might be difficult or just annoying to do so. That&#8217;s why we created JMerge.</p>
<p><a href="http://demo.lateralcode.com/jmerge">JMerge</a> is a simple web application that combines JavaScript files for you. Using it is very simple. When you first enter the page, you&#8217;ll see a URL form field:</p>
<p><img src="http://lateralcode.com/wp-content/uploads/jmerge/1.png" alt="URL Form Field" class="list-post-img" /></p>
<p>Type in the URL of your website and hit continue. After a second or two of loading, you&#8217;ll see an unordered list of JavaScript files that are used in the specified URL:</p>
<p><img src="http://lateralcode.com/wp-content/uploads/jmerge/2.png" alt="List of JavaScript Files" class="list-post-img" /></p>
<p>Click on any of the files you don&#8217;t want to merge. This will make them disappear from the list:</p>
<p><img src="http://lateralcode.com/wp-content/uploads/jmerge/3.png" alt="Small List of JavaScript Files" class="list-post-img" /></p>
<p>Now just click &#8220;combine them&#8221; and copy/paste the new code into one, merged file! That&#8217;s all it takes to combine JavaScript files with JMerge.</p>
<p>What do you think about JMerge? Was it useful for your site? Did you have any issues using it? Tell us in a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/combine-javascript-jmerge/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Screencast: Discover Search Suggest with the jQuery Autocomplete Plugin</title>
		<link>http://www.lateralcode.com/jquery-autocomplete/</link>
		<comments>http://www.lateralcode.com/jquery-autocomplete/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 19:23:58 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1244</guid>
		<description><![CDATA[Have you ever wondered how to implement a search suggest feature on your website? Contrary to popular belief, this is actually a very simple task. In the following 5 minute (yes, it only takes 5 minutes) screencast, we present a way to discover search suggest with the jQuery Autocomplete Plugin. Screencast Please watch the video [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered how to implement a search suggest feature on your website? Contrary to popular belief, this is actually a very simple task.</p>
<p>In the following 5 minute (yes, it only takes 5 minutes) screencast, we present a way to <strong>discover search suggest with the jQuery Autocomplete Plugin</strong>.</p>
<p><span id="more-1244"></span></p>
<h2>Screencast</h2>
<p>Please watch the video in full screen (button on the bottom right) for full clarity.<br />
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_0817090731.swf' /><param name='flashvars' value='i=18007' /><param name='allowFullScreen' value='true' /><embed src='http://screenr.com/Content/assets/screenr_0817090731.swf' flashvars='i=18007' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></p>
<h2>Comments?</h2>
<p>Do you have any comments, questions, or concerns? Just share them with us below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/jquery-autocomplete/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Object Oriented Programming in Javascript</title>
		<link>http://www.lateralcode.com/oop-in-js/</link>
		<comments>http://www.lateralcode.com/oop-in-js/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 12:00:13 +0000</pubDate>
		<dc:creator>Patrick Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1163</guid>
		<description><![CDATA[Object-Oriented Programming is currently one of the most prominent aspects of programming. Many programming courses teach OOP, and PHP5 supports proper OOP. While Javascript as a language is not inherently well-suited for full fledged OOP, it is possible to make it work. Here is a basic primer in using OOP in Javascript. Methods vs Objects [...]]]></description>
			<content:encoded><![CDATA[<p>Object-Oriented Programming is currently one of the most prominent aspects of programming. Many programming courses teach OOP, and PHP5 supports proper OOP. While Javascript as a language is not inherently well-suited for full fledged OOP, it is possible to make it work.</p>
<p>Here is a basic primer in using OOP in Javascript.</p>
<p><img src="http://www.lateralcode.com/wp-content/uploads/object-oriented.jpg" alt="JavaScript" class="list-post-img"/></p>
<h2>Methods vs Objects</h2>
<p>In Javascript, both general methods and objects are defined using the <code>function</code> keyword. For example, the method and the object definitions below are both denoted by <code>function</code>.</p>
<p><span id="more-1163"></span></p>
<pre><code>
function add( a, b ) {
	return a+b;
}

function sum( a, b ) {
	this.total = a+b;
}
</code></pre>
<p>The difference between a method call and an object instantiation call is the keyword <code>new</code>. The difference is illustrated in the example below:</p>
<pre><code>
var addition = add( 1, 2 );
var summation = new sum( 1, 2 );
</code></pre>
<h2>Fields</h2>
<p>In OOP in Javascript, objects have fields that store data. You have already seen an example of this earlier in the <code>sum</code> object, which stores the sum of <code>a+b</code> as <code>total</code>. All of these fields are public &#8211; that is to say, modifiable by elements other than the object itself. For example:</p>
<pre><code>
var summation = new sum( 1, 2 );
alert(summation.total); // shows 3
summation.total = 5;
alert(summation.total); // shows 5
</code></pre>
<h2>Methods in Objects</h2>
<p>Next, objects can declare their own methods. These methods can be defined within the object definition, or outside of the definition and assigned to a variable within the object definition.</p>
<p>This provides an example of the former:</p>
<pre><code>
function sum( a, b ) {
	this.total = add( a, b );
	this.print = function() {
		print(this.total);
	}
}
</code></pre>
<p>and this provides an example of the latter:</p>
<pre><code>
function sum( a, b ) {
	this.total = add( a, b );
	this.print = print;
}

function print( total ) {
	print(total);
}
</code></pre>
<h2>Inheritance</h2>
<p>Finally, a major part of OOP is inheritance. Inheritance is when a &#8220;subclass&#8221; takes on all the methods of a &#8220;superclass&#8221;. Inheritance in Javascript is done using two lines:</p>
<pre><code>
this.inheritFrom = ;
this.inheritFrom();
</code></pre>
<p>Here is an example of the subclass retaining the methods of the superclass while adding methods of its own.</p>
<pre><code>
function super() {
	this.alert = function() {
		alert("Hello!");
	}
	this.alert2 = function() {
		alert("Hello2!");
	}
}
function sub() {
	this.inheritFrom = super;
	this.inheritFrom();

	this.alert3 = function() {
		alert("Hello3!");
	}
}
var c = new sub();
c.alert(); // alerts "Hello!"
c2.alert2(); // alerts "Hello2!"
c2.alert3(); // alerts "Hello3!"
</code></pre>
<p>While this primer is not necessarily in-depth, it has hopefully given you a basic understanding how OOP works in Javascript.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/oop-in-js/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Learning jQuery 1.3 Review</title>
		<link>http://www.lateralcode.com/learning-jquery-review/</link>
		<comments>http://www.lateralcode.com/learning-jquery-review/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 07:02:40 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=1003</guid>
		<description><![CDATA[A few weeks ago, the Packt Publishing team generously sent me a copy of Learning jQuery 1.3, one of their premiere tutorial books, to review here on Lateral Code. While reading this jQuery publication, I was very surprised by the comprehensiveness provided by the authors. Many books regarding systematic subjects often require a baseline knowledge [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago, the Packt Publishing team generously sent me a copy of <a href="http://www.packtpub.com/learning-jquery-1.3/book/mid/110609lf9yuw"><em>Learning jQuery 1.3</em></a>, one of their premiere tutorial books, to review here on Lateral Code.</p>
<p>While reading this jQuery publication, I was very surprised by the comprehensiveness provided by the authors. Many books regarding systematic subjects often require a baseline knowledge to convey their information appropriately. <em>Learning jQuery 1.3</em> presents a solution for both complete beginners and experienced users. It covers simple jQuery topics &#8211; including the DOM, selectors, and basic functions &#8211; while still giving advanced users the viable alternative to move to later chapters. In fact, the book&#8217;s sections are based completely on a building process: Rather than covering topics that have little to no relevance in each chapter, <em>Learning jQuery 1.3</em> smoothly transitions into new subjects, giving the reader an efficient way to learn and develop.</p>
<p><span id="more-1003"></span></p>
<p><a href="http://www.packtpub.com/learning-jquery-1.3/book/mid/110609lf9yuw"><img src="http://www.lateralcode.com/wp-content/themes/RedEffect/images/jQuery1.3.jpg" alt="Learning jQuery 1.3" class="list-post-img"/></a></p>
<p>In the chapters themselves, this publication uses a basic learning style that gives it a characteristic development process. Throughout each section, new concepts are introduced with simple code snippets. Before putting such information away and introducing the next idea, examples are given to induce a deeper knowledge of the subject. Instead of only showing what <em>can be done</em>, the book emphasizes on <em>why and how it is done</em>. I found this to be a key help when understanding new concepts. It is one thing to just have another tool under your tool belt; if you know how to use it, you save yourself a world of time.</p>
<p>For example, in the Events chapter, the authors use the example of an interactive style switcher. From this one application alone, they present the creation of buttons, event handlers, special jQuery-applied CSS properties, event propogation/delegation, namespacing, and more. The maintenance of this single real-world application explains to the reader exactly how and why certain techniques should be used.</p>
<p>Just as the explanations are aided through examples, the whole publication is filled with images, notes, and code that help teach the reader in an organized manner. Most every example found has an accompanying image or diagram that further conveys its job. When certain features are implemented, images clearly express the new function. Furthermore, notes present in small blurbs throughout chapters add tips, tricks, and in-depth information to a jQuery application. Along with the code and images, they make new information easy to apply.</p>
<p>In addition to a solid explanation style, the book focuses a lot on implementation and efficiency. Learning how something is done only exemplifies a single dimension of jQuery. Understanding what the problems are with an application and how they can be solved efficiently brings more genuine content into this publication. It elucidates on frequent dilemmas and presents various solutions in the form of minimal code.</p>
<p>With all of the above features, <em>Learning jQuery 1.3</em> is quite a unique and comprehensive book. Its presentation style brings a new dimension to the normal way of teaching jQuery. Even though I did have experience with the subject matter prior to reading this publication, I learned quite a lot on my adventure through it. I would recommend this book to most anyone interested in taking a ride through the features and abilities of jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/learning-jquery-review/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Effects with jQuery 1.3</title>
		<link>http://www.lateralcode.com/effects-with-jquery/</link>
		<comments>http://www.lateralcode.com/effects-with-jquery/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 03:13:57 +0000</pubDate>
		<dc:creator>Karthik Viswanathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.lateralcode.com/?p=995</guid>
		<description><![CDATA[This Chapter has been extracted from Packt’s latest book “Learning jQuery 1.3”: With jQuery, we can easily add impact to our actions through a set of simple visual effects, and even craft our own, more sophisticated animations. jQuery effects certainly add flair, as is evident when we see elements gradually slide into view instead of [...]]]></description>
			<content:encoded><![CDATA[<p>This Chapter has been extracted from Packt’s latest book “Learning jQuery 1.3”:</p>
<p><a href="http://www.packtpub.com/learning-jquery-1.3/book/mid/110609lf9yuw"><img src="http://www.lateralcode.com/wp-content/themes/RedEffect/images/jQuery1.3.jpg" alt="Learning jQuery 1.3" class="list-post-img"/></a></p>
<p>With jQuery, we can easily add impact to our actions through a set of simple visual effects, and even craft our own, more sophisticated animations. jQuery effects certainly add flair, as is evident when we see elements gradually slide into view instead of appearing all at once. However, they can also provide important usability enhancements that help orient the user when there is some change on a page (especially common in AJAX applications). In this chapter, readers will explore a number of these effects and combine them in interesting ways. </p>
<p>To read more kindly visit <a href="http://www.packtpub.com/files/learning-jquery-1-3-sample-chapter-4-effects.pdf">http://www.packtpub.com/files/learning-jquery-1-3-sample-chapter-4-effects.pdf</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lateralcode.com/effects-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

