<?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>Web Development Blog &#187; AJAX</title>
	<atom:link href="http://www.scriptiny.com/category/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptiny.com</link>
	<description>This web development blog features fresh articles on JavaScript, AJAX, CSS, XHTML, PHP, Photoshop and more.</description>
	<lastBuildDate>Thu, 08 Dec 2011 02:29:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>TinyBox JavaScript Popup Box &#8211; 3.4KB</title>
		<link>http://www.scriptiny.com/2009/05/javascript-popup-box/</link>
		<comments>http://www.scriptiny.com/2009/05/javascript-popup-box/#comments</comments>
		<pubDate>Sun, 24 May 2009 21:53:19 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=174</guid>
		<description><![CDATA[TinyBox is a lightweight and standalone JavaScript popup box script. At only 3.4KB it allows for any AJAX or HTML input and can also be used for images and auto hiding alerts.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.scriptiny.com/wp-content/uploads/2009/05/tiny-box.gif" alt="JavaScript Modal Window Script" width="459" height="175" /></p>
<h3><a href="http://www.scriptiny.com/2011/03/javascript-modal-windows/"><strong>Click here</strong></a> for the latest version.</h3>
<p>TinyBox is a lightweight and standalone modal window script. At only 3.4KB it doesn&#8217;t include any slideshow capabilities built-in but allows for any AJAX or HTML input so the sky is the limit. Future versions will include additional features. It can also be used for images and auto hiding alerts. The popups fade in/out and dynamically size based on the content if enabled. The styling is completely customizable through the simple CSS. I have a couple tutorials and a few scripts I will be posting very soon so check back.</p>
<p>To display a popup box use the following code:</p>
<pre class="brush: jscript; title: ; notranslate">TINY.box.show('advanced.html',1,300,150,1,3);</pre>
<p>There is nothing to initialize, just start using the script. The TINY.box.show function takes 6 parameters: the HTML content for the box or the relative path to the AJAX source, a toggle (true/false or 1/0) if the content is via AJAX, the width of the window (use 0 for auto), the height of the window (use 0 for auto), a toggle (true/false or 1/0) to animate the window, and the time in seconds to wait before auto hiding the popup (optional).</p>
<p>This script has been tested in all major browsers and is available free of charge for both personal or commercial projects under the <a href="http://creativecommons.org/licenses/by/3.0/us/" target="_blank">creative commons license</a>. Community support is <a href="http://www.scriptiny.com/qa/">available here</a>. Paid support is also available, <a href="http://www.scriptiny.com/contact/">contact me</a> for details.</p>
<p><strong><a href="http://sandbox.scriptiny.com/tinybox/">Click here for the demo.</a></strong></p>
<p><strong><a href="http://forum.leigeber.com/index.php?app=downloads&amp;showfile=4">Click here to download the source code.</a></strong></p>
<p><strong>Update 11/15/2009</strong> – Updated logic to speed up the animation and fix a positioning issue. Slightly dropped the code weight.</p>
<p><strong>Update 11/16/2009</strong> – Fixed issue that occurred when sizing down a box.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2009/05/javascript-popup-box/feed/</wfw:commentRss>
		<slash:comments>296</slash:comments>
		</item>
		<item>
		<title>Dynamic Image Gallery and Slideshow</title>
		<link>http://www.scriptiny.com/2008/05/ajax-image-gallery-slideshow/</link>
		<comments>http://www.scriptiny.com/2008/05/ajax-image-gallery-slideshow/#comments</comments>
		<pubDate>Thu, 15 May 2008 18:11:05 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=43</guid>
		<description><![CDATA[This lightweight Ajax image gallery and slideshow script clocks in under 3kb packed with a number of cool features.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.scriptiny.com/wp-content/uploads/2008/05/slideshow.jpg" alt="Ajax Image Gallery" width="459" height="250" /></p>
<p><strong>The updated version of the script is <a href="http://www.scriptiny.com/2008/12/javascript-slideshow/">available here</a>.</strong></p>
<p>This extremely lightweight JavaScript image gallery and slideshow script clocks in under 3kb packed and includes a number of cool features. Recently I was looking for a nice existing script for a client project. I wanted something elegant, simple and lightweight. What I found were a number of scripts built on JavaScript frameworks and a few others that really lacked any appealing interface or were over  30kb. I challenged myself to build a full-featured slideshow gallery under 4kb. Hopefully I will be add a few more features to the script soon and make it a little mode user-friendly.</p>
<p>Here is an example of the markup&#8230;</p>
<pre class="brush: xml; title: ; notranslate">&lt;div id=&quot;gallery&quot;&gt;
&lt;div id=&quot;imagearea&quot;&gt;
&lt;div id=&quot;image&quot;&gt;
&lt;a href=&quot;javascript:slideShow.nav(-1)&quot; id=&quot;previmg&quot;&gt;&lt;/a&gt;
&lt;a href=&quot;javascript:slideShow.nav(1)&quot; id=&quot;nextimg&quot;&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;thumbwrapper&quot;&gt;
&lt;div id=&quot;thumbarea&quot;&gt;
&lt;ul id=&quot;thumbs&quot;&gt;
&lt;li value=&quot;1&quot;&gt;&lt;img src=&quot;thumbs/1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;li value=&quot;2&quot;&gt;&lt;img src=&quot;thumbs/2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;li value=&quot;3&quot;&gt;&lt;img src=&quot;thumbs/3.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;li value=&quot;4&quot;&gt;&lt;img src=&quot;thumbs/4.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;li value=&quot;5&quot;&gt;&lt;img src=&quot;thumbs/5.jpg&quot; alt=&quot;&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<p>The list section is the important element to the gallery. Each li has a value property that is set to the name of the full-size image. The interface is very flexible and can easily be altered in the HTML and CSS.</p>
<p>You will also need to setup the variables below and include the slideshow JavaScript&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">var imgid = 'image'; // id of image div //
var imgdir = 'fullsize'; // full-size image directory //
var imgext = '.jpg'; // full-size image extension //
var thumbid = 'thumbs'; // id of the thumbnail container //
var auto = true; // automatic rotation toggle //
var autodelay = 5; // seconds before the image rotates //</pre>
<p>This script isn&#8217;t completely polished yet but I wanted to go ahead and get it out there for anyone that can put it to use. It has been tested in all major browsers and is available free of charge for both personal or commercial projects under the <a href="http://creativecommons.org/licenses/by/3.0/us/" target="_blank">creative commons license</a>. Community support is <a href="http://www.scriptiny.com/qa/">available here</a>. Paid support is also available, <a href="http://www.scriptiny.com/contact/">contact me</a> for details.</p>
<p><strong><a href="http://sandbox.scriptiny.com/slideshow/" target="_blank">Click here for the demo.</a></strong></p>
<p><strong><a href="http://www.scriptiny.com/wp-content/uploads/2008/05/slideshow.zip">Click here to download the source.</a></strong></p>
<p><strong>Update 5/16/2008</strong> &#8211; Updated CSS and added outline:none for the next and previous links.<br />
<strong>Update 5/26/2008</strong> &#8211; Updated the CSS to resolve an issue with resizing the window in IE6. Thanks to Jon Stoski for reporting.<br />
<strong>Update 5/28/2008</strong> &#8211; Pushed script inside global namespace. Fixed a couple IE related bugs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2008/05/ajax-image-gallery-slideshow/feed/</wfw:commentRss>
		<slash:comments>302</slash:comments>
		</item>
		<item>
		<title>5 JavaScript Best Practices</title>
		<link>http://www.scriptiny.com/2008/04/5-javascript-best-practices/</link>
		<comments>http://www.scriptiny.com/2008/04/5-javascript-best-practices/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 17:19:08 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=15</guid>
		<description><![CDATA[JavaScript is an extremely powerful and flexible scripting language. This article highlights 5 JavaScript best practices to keep in mind.]]></description>
			<content:encoded><![CDATA[<p>JavaScript is an extremely powerful and flexible scripting language. Unfortunately flexible, for many people, means fallible. I am going to highlight 5 best practices that you can use in any JavaScript project. These are very broad, I will follow up soon with more specific best practices.</p>
<p><strong>First and foremost, keep your code simple, clean and well documented</strong>. This is by no means unique to JavaScript but many people seem to think it is the exception to the rule. Your code should naturally comment itself but it is also important to at least introduce every function. I recommend two versions, a fully documented and formatted version and then a compressed version that you use in production. There are a number of free online utilities that can strip out comments and pack your script. There is no need to push out the extra size required for the documentation and formatting.</p>
<p><strong>Second, keep your JavaScript in an external file</strong>. The only exception to this rule is if you have some very lightweight script specific to a single page or are setting up variables that cannot be done in the external JS. An external file results in greater scalability, maintainability and degradability. The correct way to reference an external JS file is as follows:</p>
<p><code>&lt;script type="text/javascript" src="script.js">&lt;/script></code></p>
<p><strong>Third, separate your JavaScript from the presentation layer</strong>. We have all heard of unobtrusive JavaScript but we still see inline script all the time. Instead of cluttering your font-end code with dozens of event handlers add them dynamically. There are exceptions to this rule so please use common sense and separate the layers when it makes sense. An example of adding an onclick event handler from JavaScript:</p>
<p><code>var div = document.getElementById('div');<br />
div.onclick = new Function("processClick(this)");</code></p>
<p><strong>Fourth, properly define and scope variables</strong>. Many of the scripts I download hoping to use in a project I immediately throw out. The reason being that the programmer did not take the time to properly define and scope variables. Always reference the first instance of a variable by using var. Otherwise the only way someone can know if that is the first reference to that variable is by starting at the top and reading all the way down. It is also important to scope variables correctly. Don&#8217;t scope a variable on the global level unless you need it there. I also recommend differentiation of global and local variables though some kind of visual identifier such is all caps on global variables or some easily identifiable character.</p>
<p><strong>Fifth, don&#8217;t assume JavaScript support in the first place</strong>. Depending on your audience you may choose to disregard this suggestion but for mainstream websites I highly suggest coding with the minority in mind (an estimated 5-10% of web users do not have JavaScript enabled) and degrade your scripts gracefully. JavaScript should be considered as an added feature and not a dependency. An examples of this would be links, the most fundamental element of a web page.</p>
<p><code>&lt;a href="javascript:processClick()">link&lt;/a><br />
&lt;a href="#" onclick="javascript:processClick()">link&lt;/a><br />
</code></p>
<p>If the user clicks the either of the links above with JavaScript disabled nothing will happen. However, with the code below they could still navigate.</p>
<p><code>&lt;a href="link.html" onclick="processClick(); return false;">link&lt;/a></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2008/04/5-javascript-best-practices/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

