<?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; JavaScript</title>
	<atom:link href="http://www.scriptiny.com/category/javascript/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>JavaScript Dropdown Menu</title>
		<link>http://www.scriptiny.com/2011/04/javascript-dropdown-menu/</link>
		<comments>http://www.scriptiny.com/2011/04/javascript-dropdown-menu/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 23:45:52 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=419</guid>
		<description><![CDATA[This JavaScript dropdown menu script offers improved stability, speed, and features. Added features include animation toggles, a speed toggle, a rollout timeout, and improved style handling. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.scriptiny.com/wp-content/uploads/2011/04/tinydropdown.jpg" alt="JavaScript Dropdown Menu" width="592" height="225" /></p>
<p>This update to the TinyDropdown dropdown menu script offers improved stability, speed, and features. Added features include animation toggles, a speed toggle, a rollout timeout, and improved style handling. The script is still very lightweight at only 1.7KB packed and should perform noticeably better than the previous version. Styling is completely flexible through the CSS&#8230; you can even make this a vertical menu with a few tweaks.</p>
<p>The script is executed by passing an object to the init function. A sample call  would look like the following:</p>
<pre class="brush: jscript; title: ; notranslate">var dropdown=new TINY.dropdown.init(&quot;dropdown&quot;, {id:'menu', active:'menuhover', fade:true, slide:true, timeout:200});</pre>
<p>Parameters include (tag &#8211; description (type) &#8211; default):</p>
<pre class="brush: jscript; title: ; notranslate">id - ID of the navigation (string - required) - ''
active - CSS class for active state (string) - ''
fade - toggle fade tween (bool) - true
slide - toggle slide tween (bool) - true
speed- toggle slide tween (1-9) - 5
timeout - time in milliseconds to pause before hide on rollout (int) - 200</pre>
<h3><strong><a href="http://sandbox.scriptiny.com/tinydropdown2/">Click here</a></strong> for the demo.</h3>
<h3><strong><a href="http://forum.leigeber.com/index.php?app=downloads&amp;module=display&amp;section=download&amp;do=confirm_download&amp;id=15">Click here</a></strong> to download.</h3>
<p>This script is tested in IE7+, FF, Chrome, Opera, and Safari 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>. I welcome any bug reports. Head to the <a href="http://www.scriptiny.com/qa/">Scriptiny QA</a> for community support.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2011/04/javascript-dropdown-menu/feed/</wfw:commentRss>
		<slash:comments>141</slash:comments>
		</item>
		<item>
		<title>JavaScript Modal Windows &#8211; TinyBox2</title>
		<link>http://www.scriptiny.com/2011/03/javascript-modal-windows/</link>
		<comments>http://www.scriptiny.com/2011/03/javascript-modal-windows/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 16:35:44 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[box]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=391</guid>
		<description><![CDATA[This update to the TinyBox modal window script brings a ton of new features and still clocks in under 5KB.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.scriptiny.com/wp-content/uploads/2011/03/tinybox2.jpg" alt="JavaScript Modal Windows" width="592" height="225" /></p>
<p>This update to the TinyBox modal box script brings a ton of new features and still clocks in under 5KB. The script now supports iframes and images natively. You can POST with Ajax. Clicking ESC will close the window. Callback functions can be passed for load and close events. You can set CSS IDs to override the default styling. CSS position can be toggled between fixed and absolute. The mask opacity can be sent. You have full control over window location. And of course there is now a close button out of the box you can toggle.</p>
<p>The script is now executed by passing an object due to the large number of options. There is nothing to initialize, just call the function on whatever mouse or browser event you like. A sample call would look like the following:</p>
<pre class="brush: jscript; title: ; notranslate">TINY.box.show({url:'advanced.html',width:300,height:150})</pre>
<p>Parameters include (tag &#8211; description (type) &#8211; default):</p>
<pre class="brush: jscript; title: ; notranslate">html - HTML content for window (string) - false
iframe - URL for embedded iframe (string) - false
url - path for AJAX call (string) - false
post - post variable string, used in conjunction with url (string) - false
image - image path (string) - false
width - preset width (int) - false
height - preset height (int) - false
animate - toggle animation (bool) - true
close - toggle close button (bool) - true
openjs - generic function executed on open (string) - null
closejs - generic function executed on close (string) - null
autohide - number of seconds to wait until auto-hiding (int) - false
boxid - ID of box div for style overriding purposes (string) - ''
maskid - ID of mask div for style overriding purposes (string) - ''
fixed - toggle fixed position vs static (bool) - true
opacity - set the opacity of the mask from 0-100 (int) - 70
mask - toggle mask display (bool) - true
top - absolute pixels from top (int) - null
left - absolute pixels from left (int) - null
topsplit - 1/x where x is the denominator in the split from the top (int) - 2</pre>
<p>Nearly all of the parameters above are optional. Of course you must include either the html, iframe, url, or image parameters as they drive the content. Height and width are option and will be calculated based on offsetWidth and offsetHeight in the case of HTML or Ajax content else by actual width and height with images. Iframe calls must include a height and width. By default the box will animate in the center of the screen in a fixed position.</p>
<h3><strong><a href="http://sandbox.scriptiny.com/tinybox2/">Click here</a></strong> for the demo.</h3>
<h3><strong><a href="http://forum.leigeber.com/index.php?app=downloads&amp;module=display&amp;section=download&amp;do=confirm_download&amp;id=14">Click here</a></strong> to download.</h3>
<p>This script is tested in IE7+, FF, Chrome, Opera, and Safari 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>. This is a never-ending work in progress and I welcome any bug reports.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2011/03/javascript-modal-windows/feed/</wfw:commentRss>
		<slash:comments>230</slash:comments>
		</item>
		<item>
		<title>JavaScript Fade Tutorial &#8211; Fading Elements In/Out</title>
		<link>http://www.scriptiny.com/2011/01/javascript-fade-in-out/</link>
		<comments>http://www.scriptiny.com/2011/01/javascript-fade-in-out/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 05:01:32 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[fade]]></category>
		<category><![CDATA[fading]]></category>
		<category><![CDATA[tween]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=382</guid>
		<description><![CDATA[One of the most common JavaScript effects is fading elements and text in and out. Fortunately, it isn't very difficult to script and doesn't require a JavaScript framework.]]></description>
			<content:encoded><![CDATA[<p>One of the most common JavaScript effects is fading elements and text in and out. Fortunately, it isn&#8217;t very difficult to script and doesn&#8217;t require a JavaScript framework. This tutorial walks through creating a well-coded standalone fading script.</p>
<p>To begin, let&#8217;s create a wrapper object for our functions. It will return two functions: an initialization function and a tween function that will handle the animation. For the init function, we will pass the ID of the element we want to animate as the first parameter. The second parameter will be a toggle (1 or -1) to determine the direction of the fade. The third will be the target (0-100) which will default to 0 or 100 based on the direction.</p>
<pre class="brush: jscript; title: ; notranslate">var fadeEffect=function(){
	return{
		init:function(id, flag, target){
		},
		tween:function(){
		}
	}
}();</pre>
<p>Now let&#8217;s fill in the first function&#8230;. here is a breakdown of the lines followed by the code:</p>
<ol>
<li>Create an object variable to reference the element we are fading</li>
<li>Clear any active fading on the element</li>
<li>Set the target opacity to the passed variable else check the direction to determine the default</li>
<li>Set the internal flag to 1 or -1 based on the boolean (0/1) passed as the parameter</li>
<li>Get the opacity off the DOM if available else assume it is 0 (for purposes of this demo)</li>
<li>Set the tween function to be executed every 20 milliseconds until cancelled</li>
</ol>
<pre class="brush: jscript; title: ; notranslate">this.elem = document.getElementById(id);
clearInterval(this.elem.si);
this.target = target ? target : flag ? 100 : 0;
this.flag = flag || -1;
this.alpha = this.elem.style.opacity ? parseFloat(this.elem.style.opacity) * 100 : 0;
this.si = setInterval(function(){fadeEffect.tween()}, 20);</pre>
<p>Next we complete the tween function to update the opacity/alpha on the previously set interval.</p>
<ol>
<li>Check if the current opacity is equal to the target opacity</li>
<li>If previous is true clear the interval/exit</li>
<li>Else</li>
<li>Calculate the new opacity with easing (modify the &#8220;.05&#8243; value to control speed)</li>
<li>Divide the calculated value by 100 for standard CSS opacity (0-1)</li>
<li>Set the IE based opacity filter (0-100)</li>
</ol>
<pre class="brush: jscript; title: ; notranslate">if(this.alpha == this.target){
	clearInterval(this.elem.si);
}else{
	var value = Math.round(this.alpha + ((this.target - this.alpha) * .05)) + (1 * this.flag);
	this.elem.style.opacity = value / 100;
	this.elem.style.filter = 'alpha(opacity=' + value + ')';
	this.alpha = value
}</pre>
<p>And all together now&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">var fadeEffect=function(){
	return{
		init:function(id, flag, target){
			this.elem = document.getElementById(id);
			clearInterval(this.elem.si);
			this.target = target ? target : flag ? 100 : 0;
			this.flag = flag || -1;
			this.alpha = this.elem.style.opacity ? parseFloat(this.elem.style.opacity) * 100 : 0;
			this.si = setInterval(function(){fadeEffect.tween()}, 20);
		},
		tween:function(){
			if(this.alpha == this.target){
				clearInterval(this.elem.si);
			}else{
				var value = Math.round(this.alpha + ((this.target - this.alpha) * .05)) + (1 * this.flag);
				this.elem.style.opacity = value / 100;
				this.elem.style.filter = 'alpha(opacity=' + value + ')';
				this.alpha = value
			}
		}
	}
}();</pre>
<p>You can call the function like so:</p>
<pre class="brush: jscript; title: ; notranslate">fadeEffect.init('fade', 1, 50) // fade in the &quot;fade&quot; element to 50% transparency
fadeEffect.init('fade', 1) // fade out the &quot;fade&quot; element</pre>
<h3><strong><a href="http://sandbox.scriptiny.com/javascript-fading/">Click here</a></strong> for the demo.</h3>
<h3><strong><a href="http://sandbox.scriptiny.com/javascript-fading/fading.zip">Click here</a></strong> to download.</h3>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2011/01/javascript-fade-in-out/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>JavaScript Slider &#8211; TinySlider 2</title>
		<link>http://www.scriptiny.com/2011/01/javascript-slider/</link>
		<comments>http://www.scriptiny.com/2011/01/javascript-slider/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 01:41:47 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=375</guid>
		<description><![CDATA[This full-featured and standalone JavaScript slider is easily configurable and visually customizable using CSS. It also clocks in at a tiny 3KB.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.scriptiny.com/wp-content/uploads/2011/01/tinyslider.jpg" alt="JavaScript Slider" width="592" height="225" /></p>
<p>This full-featured and standalone JavaScript slider is easily configurable and visually customizable using CSS. It also clocks in at a tiny 3KB. Features included from the first version include automatic rotation with the option to auto-resume, an active class on a navigation list if applicable, and a direction toggle (vertical or horizontal). Updates include more fluid motion, an elastic tween option, continuous sliding without rewind, and a couple other fixes/tweaks. It accepts any content and gracefully degrades when JavaScript isn&#8217;t available. Stay tuned for an updated TinyBox soon.</p>
<p>To initialize the script use the following:</p>
<pre class="brush: jscript; title: ; notranslate">var slideshow=new TINY.slider.slide('slideshow',{
id:'slider',
auto:4, // false for no automation else the number of seconds between slides
resume:false, // continue auto sliding after interruption
vertical:false,
navid:'pagination', // ID of pagination UL
activeclass:'current', // active class for pagination
position:0, // initial position index
rewind:false, // toggle &quot;rewinding&quot;, else the slides will be continuous
elastic:true, // toggle the bouncing effect of the slides
left:'slideleft', // ID of left nav, to cancel cursor selection
right:'slideright' // ID of left nav, to cancel cursor selection
});</pre>
<p>The first parameter taken by TINY.slider.slide is the variable name used for the object instance. You can also manually set the width/height parameter for the applicable direction you are sliding. If it is not set the width or height will be automatically calculated using the first list element. 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/">creative commons  license</a>. Community support is <a href="http://www.scriptiny.com/qa/">available here</a>. Paid support is also available, <a href="../contact/">contact me</a> for details. Images are copyrighted by Warner Bros.</p>
<h3><strong><a href="http://sandbox.scriptiny.com/tinyslider2/">Click here</a></strong> for the demo.</h3>
<h3><strong><a href="http://forum.leigeber.com/index.php?app=downloads&amp;module=display&amp;section=download&amp;do=confirm_download&amp;id=13">Click here</a></strong> to download.</h3>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2011/01/javascript-slider/feed/</wfw:commentRss>
		<slash:comments>138</slash:comments>
		</item>
		<item>
		<title>Simple AJAX Function with Example</title>
		<link>http://www.scriptiny.com/2011/01/simple-ajax-function-example/</link>
		<comments>http://www.scriptiny.com/2011/01/simple-ajax-function-example/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 03:15:09 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[AJAX]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=362</guid>
		<description><![CDATA[TinyAjax is a simple AJAX function that makes it easy to call and process GET and POST transactions. Check out the example.]]></description>
			<content:encoded><![CDATA[<p>Below is the simple AJAX function that I use in many of my projects, TinyAjax. It makes it easy to call and process GET and POST transactions. Here are the parameters:</p>
<ol>
<li>URL (required)</li>
<li>ID of the output element (pass a zero/false for no response output)</li>
<li>String of function to be evaluated and called on completion (optional)</li>
<li>Post content &#8211; example: id=22&amp;action=1 (optional)</li>
</ol>
<p>I will be posting more small snippets soon as well as some updates to previous scripts, new code, and tutorials. Last year was roller coaster with getting my business off the ground and it shows in my lack of time for this site. That being said, I plan to take more time to give back  this year and grow my own skills so expect to see much more of me on here. I cleaned up the forums and implemented DISQUS to help everyone get the most out of this site.</p>
<p>On a side note, I have formed a new company this year with a partner and  we are opening an office in historic downtown Franklin, TN. We will be  looking for some good people to work with us so if you or anyone you  know is in the Nashville area, please have them drop me a line.</p>
<pre class="brush: jscript; title: ; notranslate">TINY={};

function T$(id){return document.getElementById(id)}

TINY.ajax=function(){
    return{
        call:function(u,d,f,p){
            var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
            x.onreadystatechange=function(){
                if(x.readyState==4&amp;&amp;x.status==200){
                    if(d){
                        var t=T$(d);
                        t.innerHTML=x.responseText
                    }
                    if(f){
                        var c=new Function(f); c()
                    }
                }
            };
            if(p){
                x.open('POST',u,true);
                x.setRequestHeader('Content-type','application/x-www-form-urlencoded');
                x.send(p)
            }else{
                x.open('GET',u,true);
                x.send(null)
            }
        }
    };
}();</pre>
<p>A call would look something like the following:</p>
<pre class="brush: jscript; title: ; notranslate">TINY.ajax.call('get.php?id=32', 'content', 'display(&quot;red&quot;)'); // GET
TINY.ajax.call('post.php', 'content', 'display(&quot;green&quot;)', 'id=32'); // POST</pre>
<h3><strong><a href="http://sandbox.scriptiny.com/tinyajax/">Click here</a></strong> for the demo.</h3>
<h3><strong><a href="http://forum.leigeber.com/index.php?app=downloads&amp;module=display&amp;section=download&amp;do=confirm_download&amp;id=12">Click here</a></strong> to download PHP example.</h3>
<p>Keep in mind that this will not work on your local computer unless you are running a web server like Apache. 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/">creative commons  license</a>. Community support is <a href="http://www.scriptiny.com/qa/">available  here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2011/01/simple-ajax-function-example/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Fading JavaScript Slideshow – TinyFader</title>
		<link>http://www.scriptiny.com/2010/09/fading-slideshow-script/</link>
		<comments>http://www.scriptiny.com/2010/09/fading-slideshow-script/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 21:37:48 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://www.scriptiny.com/?p=354</guid>
		<description><![CDATA[This 1.4KB fading slideshow script can easily be customized with CSS. It is completely standalone and uses a simple unordered list structure to support any content. It even gracefully degrades without JavaScript support. The script supports automatic rotation with the option to auto-resume, an active class on a navigation list if applicable, and an initial display toggle.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.scriptiny.com/wp-content/uploads/2010/09/tiny-fader.jpg" alt="Tiny Fader" width="592" height="225" /></p>
<p>This 1.4KB fading slideshow script can easily be customized with CSS. It is a slight variation from the TinySlider script and is still completely standalone and uses a simple unordered list structure to support any content. It even gracefully degrades without JavaScript support. The script supports automatic rotation with the option to auto-resume, an active class on a navigation list if applicable, and an initial display toggle.</p>
<p>Self-employment has kept away from my blog for quite awhile but I hope to be spending more time here soon. I will be addressing all of the accumulated requests and bug reports for all of my scripts as soon as I possibly can. I also have a couple updated script versions and completely new scripts in the works as well as some post ideas. If you have emailed me anytime in the last 6 months or so I sincerely apologize if I did not get back with you, I just had too much going on to deal with all to all correspondence.</p>
<p>To initialize the script use the following:</p>
<pre class="brush: jscript; title: ; notranslate">var slideshow=new TINY.slider.slide('slideshow',{
	id:'slides', // ID of the parent slideshow unordered list
	auto:3, // Seconds to auto-advance, defaults to disabled
	resume:true, // Resume after interrupted, defaults to false
	navid:'pagination', // Optional ID of direct navigation UL
	activeclass:'current', // If navid, class to set on the current LI
	visible:true, // Initially display the first slide vs fading it in
	position:0 // Initial slide position, defaulting to the 0 index
});</pre>
<p>The first parameter taken by TINY.fader.fade is the variable name used for the object instance. 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/">creative commons license</a>. Community support is <a href="http://www.scriptiny.com/qa/">available here</a>.</p>
<p><a href="http://sandbox.scriptiny.com/tinyfader/">Click here for the demo.</a></p>
<p><a href="http://forum.leigeber.com/index.php?app=downloads&amp;showfile=11">Click here to download the source code.</a></p>
<p><strong>9/30/2010</strong> &#8211; Resolved IE bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptiny.com/2010/09/fading-slideshow-script/feed/</wfw:commentRss>
		<slash:comments>111</slash:comments>
		</item>
	</channel>
</rss>

