<?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>ajaxBlender.com&#8212; jQuery Scripts. Custom jQuery Programming. jQuery Scripts Integration.</title>
	<atom:link href="http://www.ajaxblender.com/jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxblender.com</link>
	<description>A Whole Lot of AJAX!</description>
	<lastBuildDate>Mon, 02 May 2011 07:38:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>bgStretcher II</title>
		<link>http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html</link>
		<comments>http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html#comments</comments>
		<pubDate>Tue, 26 Apr 2011 11:50:16 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Effects]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[jquery effects]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/new-bgstretcher.html</guid>
		<description><![CDATA[bgStretcher 2011 (Background Stretcher) is a jQuery plug-in which allows you to add a large image (or a set of images) to the background of your web page and will proportionally resize the image(s) to fill the entire window area. The plug-in will work as a slideshow if multiple images mode is used (the speed [...]]]></description>
			<content:encoded><![CDATA[<p>bgStretcher 2011 (Background Stretcher) is a jQuery plug-in which allows you to add a large image (or a set of images) to the background of your web page and will proportionally resize the image(s) to fill the entire window area. The plug-in will work as a slideshow if multiple images mode is used (the speed and duration for the slideshow is configurable).<span id="more-1202"></span><br />
bgStretcher 2011 has tons of new features suggested by our users. We appreciate all your feedback, and you will see below that we have implemented many new features and functions requested. Please continue to help us improve it by leaving suggestions in our comments area or you may contact us directly.</p>
<h3>Features</h3>
<ol>
<li>Unobtrusive script, simple to setup</li>
<li>Works with all modern browsers</li>
<li>Supports single and multiple images</li>
</ol>
<p>&nbsp;</p>
<h3>How to Use</h3>
<p>1. Download bgStretcher script. The package already contains the jQuery framework.</p>
<p>2. Add the following code to your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag to connect jQuery framework, bgStretcher plugin and CSS. <em>(Make sure paths to files are correct.)</em></p>
<pre class="html">
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;../jquery-1.5.2.min.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;../bgstretcher.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlOtherTag">&lt;link rel=<span class="htmlAttributeValue">&quot;stylesheet&quot;</span> href=<span class="htmlAttributeValue">&quot;../bgstretcher.css&quot;</span> /&gt;</span>
</pre>
<p>3. Use the following code to initialize the bgStretcher (see Options section below for details):</p>
<pre class="php">
<span class="phpOperator">&lt;</span>script type=<span class="phpString">"text/javascript"</span><span class="phpOperator">&gt;</span>
$<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
<span class="phpComment">//  Initialize Backgound Stretcher
</span>$<span class="phpOperator">(</span><span class="phpString">'BODY'</span><span class="phpOperator">)</span>.bgStretcher<span class="phpOperator">(</span><span class="phpOperator">{</span>
images<span class="phpOperator">:</span> <span class="phpOperator">[</span><span class="phpString">'images/sample-<span class="phpNumber">1</span><span class="phpOperator">.</span>jpg'</span>, <span class="phpString">'images/sample-<span class="phpNumber">2</span><span class="phpOperator">.</span>jpg'</span>, <span class="phpString">'images/sample-<span class="phpNumber">3</span><span class="phpOperator">.</span>jpg'</span>, <span class="phpString">'images/sample-<span class="phpNumber">4</span><span class="phpOperator">.</span>jpg'</span><span class="phpOperator">]</span>, imageWidth<span class="phpOperator">:</span> 1024, imageHeight<span class="phpOperator">:</span> 768
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">&lt;</span>/script<span class="phpOperator">&gt;</span>
</pre>
<p>And if you want to initialize plugin for custom div use next:</p>
<pre class="php">
<span class="phpOperator">&lt;</span>script type=<span class="phpString">"text/javascript"</span><span class="phpOperator">&gt;</span>
$<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
<span class="phpComment">//  Initialize Backgound Stretcher
</span>$<span class="phpOperator">(</span><span class="phpString">'<span class="phpOperator">.</span>classname-of-div'</span><span class="phpOperator">)</span>.bgStretcher<span class="phpOperator">(</span><span class="phpOperator">{</span>
images<span class="phpOperator">:</span> <span class="phpOperator">[</span><span class="phpString">'images/sample-<span class="phpNumber">1</span><span class="phpOperator">.</span>jpg'</span>, <span class="phpString">'images/sample-<span class="phpNumber">2</span><span class="phpOperator">.</span>jpg'</span>, <span class="phpString">'images/sample-<span class="phpNumber">3</span><span class="phpOperator">.</span>jpg'</span>, <span class="phpString">'images/sample-<span class="phpNumber">4</span><span class="phpOperator">.</span>jpg'</span><span class="phpOperator">]</span>, imageWidth<span class="phpOperator">:</span> 1024, imageHeight<span class="phpOperator">:</span> 768
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">&lt;</span>/script<span class="phpOperator">&gt;</span>
</pre>
<p>4. Insert content of your page inside BODY or custom DIV:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;body&gt;</span>
<span class="htmlOtherTag">&lt;div class=<span class="htmlAttributeValue">&quot;classname-of-div&quot;</span>&gt;</span>
Your content goes here...
<span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;/body&gt;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to see it in action.</p>
<h3>Options</h3>
<table class="options" border="0">
<tbody>
<tr>
<th>Configuration Option</th>
<th>Default Value</th>
<th>Description</th>
</tr>
<tr>
<td><strong>imageContainer</strong></td>
<td>bgstretcher</td>
<td>bgStretcher will automatically build structure for the images list in a DOM tree. This parameter is ID for the images holder. Try inspecting the tree with a <a href="http://getfirebug.com/" target="_blank">FireBug</a> to get an idea how it&#8217;s constructed.</td>
</tr>
<tr class="odd">
<td><strong>resizeProportionally</strong></td>
<td>true</td>
<td>Indicates if background image(s) will be resized proportionally or not.</td>
</tr>
<tr>
<td><strong>resizeAnimate</strong></td>
<td>false</td>
<td>Indicates if background image(s) will be resized with animation. (Be careful, this may slow down some PCs if your images are large.)</td>
</tr>
<tr class="odd">
<td><strong>images</strong></td>
<td><em>empty</em></td>
<td>An array containing list of images to be displayed on page&#8217;s background.</td>
</tr>
<tr>
<td><strong>imageWidth</strong></td>
<td>1024</td>
<td>Original image&#8217;s width.</td>
</tr>
<tr class="odd">
<td><strong>imageHeight</strong></td>
<td>768</td>
<td>Original image&#8217;s height.</td>
</tr>
<tr>
<td><strong>maxWidth</strong></td>
<td>auto</td>
<td>Maximum image&#8217;s width.</td>
</tr>
<tr class="odd">
<td><strong>maxHeight</strong></td>
<td>auto</td>
<td>Maximum image&#8217;s height.</td>
</tr>
<tr>
<td><strong>nextSlideDelay</strong></td>
<td>3000 <em>(3 seconds)</em></td>
<td>Numeric value in milliseconds. The parameter sets delay until next slide should start.</td>
</tr>
<tr class="odd">
<td><strong>slideShowSpeed</strong></td>
<td>normal</td>
<td>Numeric value in milliseconds or jQuery string value (&#8217;fast&#8217;, &#8216;normal&#8217;, &#8217;slow&#8217;). The parameter sets the speed of transition between images.</td>
</tr>
<tr>
<td><strong>slideShow</strong></td>
<td>true</td>
<td>Allows or disallows slideshow functionality.</td>
</tr>
<tr class="odd">
<td><strong>transitionEffect</strong></td>
<td>fade</td>
<td>Transition effect (use also: none, simpleSlide, superSlide).</td>
</tr>
<tr>
<td><strong>slideDirection</strong></td>
<td>N</td>
<td>Slide Diraction: N &#8211; north, S &#8211; south, W &#8211; west, E &#8211; East (if transitionEffect = superSlide use also: NW, NE, SW, SE).</td>
</tr>
<tr class="odd">
<td><strong>sequenceMode</strong></td>
<td>normal</td>
<td>Sequence mode (use also: back, random)</td>
</tr>
<tr>
<td><strong>buttonPrev</strong></td>
<td>empty</td>
<td>Previous button CSS selector</td>
</tr>
<tr class="odd">
<td><strong>buttonNext</strong></td>
<td>empty</td>
<td>Next button CSS selector</td>
</tr>
<tr>
<td><strong>pagination</strong></td>
<td>empty</td>
<td>CSS selector for pagination</td>
</tr>
<tr class="odd">
<td><strong>anchoring</strong></td>
<td>&#8216;left top&#8217;</td>
<td>Anchoring bgStrtcher area regarding window</td>
</tr>
<tr>
<td><strong>anchoringImg</strong></td>
<td>&#8216;left top&#8217;</td>
<td>Anchoring images regarding window</td>
</tr>
<tr class="odd">
<td><strong>preloadImg</strong></td>
<td>false</td>
<td>For Preload images use true</td>
</tr>
<tr>
<td><strong>stratElementIndex</strong></td>
<td>0</td>
<td>Start element index</td>
</tr>
<tr class="odd">
<td><strong>callbackfunction</strong></td>
<td>null</td>
<td>Name of callback function</td>
</tr>
</tbody>
</table>
<h3>Methods</h3>
<table class="options" border="0">
<tbody>
<tr>
<th>Method Name</th>
<th>Description</th>
</tr>
<tr>
<td><strong>$(objID).bgStretcher.play()</strong></td>
<td>Resume background slideshow</td>
</tr>
<tr class="odd">
<td><strong>$(objID).bgStretcher.pause()</strong></td>
<td>Pause background slideshow</td>
</tr>
<tr>
<td><strong>$(objID).bgStretcher.sliderDestroy()</strong></td>
<td>Destroy background slideshow</td>
</tr>
</tbody>
</table>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1202&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html/feed</wfw:commentRss>
		<slash:comments>98</slash:comments>
		</item>
		<item>
		<title>Browser Detection</title>
		<link>http://www.ajaxblender.com/browser-detection.html</link>
		<comments>http://www.ajaxblender.com/browser-detection.html#comments</comments>
		<pubDate>Wed, 24 Nov 2010 12:50:20 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[browser detection]]></category>
		<category><![CDATA[detect old browsers]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1190</guid>
		<description><![CDATA[Our friends at DevSlide recently launched a Labs area where they publish ideas, software, script, apps, etc., and we thought that this one could be interesting for JS developers and webmasters. It is a JavaScript browser detection tool that detects the user’s browser. If an old browser is detected, it will display a friendly suggestion [...]]]></description>
			<content:encoded><![CDATA[<p>Our friends at DevSlide recently launched a Labs area where they publish ideas, software, script, apps, etc., and we thought that this one could be interesting for JS developers and webmasters. It is a JavaScript browser detection tool that detects the user’s browser. If an old browser is detected, it will display a friendly suggestion for them to upgrade their browser to the latest version or download a new browser.<span id="more-1190"></span></p>
<h2>Background</h2>
<p>Coding for old browsers (such as old versions of Internet Explorer, Firefox, Opera) can be a nightmare even for experienced web developers who hand code XHTML/CSS markup. It is difficult to find a balance of features, speed, and browser compatibility. It is particularly frustrating when you run a JS / CSS3 website and know that only a small percentage of your users are preventing you from using all the features of CSS3 (which, when used correctly, is feature rich, optimizes page load speeds and is easier to maintain). </p>
<p>Well, we have not opened a new world here :). But, this is a big problem and it is further complicated, because most users who are running such an out-dated browser do not even know where to go to upgrade their browser. The DevSlide team created a script written from scratch in JavaScript and will not conflict with any existing JavaScript frameworks such as jQuery, and MooTools. It displays a nicely styled and friendly message. You can choose from five predefined messages (professional, informal, goofy, technical, and even a mean one, lol) or customize your own message. There is also a cookie feature, so that the user can choose to ignore the message or ask to be reminded later.</p>
<h2>How to Install It</h2>
<p>It&#8217;s easy to add to your site and configure. There is even a <a href="http://www.devslide.com/labs/browser-detection/configure">configuration form</a> where you can customize it and load it from the DevSlide servers or download and host it on your server.</p>
<p>1.) Go to <a href="http://www.devslide.com/labs/browser-detection">DevSlide Labs</a> and configure the script.<br />
2.) Add generated code to your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag.<br />
3.) Help us all to eliminate out dated browsers ;)</p>
<p>That&#8217;s it ;) Click the links below to visit DevSlide Labs to download and configure the script.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1190&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/browser-detection.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>jFiller</title>
		<link>http://www.ajaxblender.com/jfiller.html</link>
		<comments>http://www.ajaxblender.com/jfiller.html#comments</comments>
		<pubDate>Mon, 26 Apr 2010 08:08:30 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[auto forms filling]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1157</guid>
		<description><![CDATA[Our team often works on developing server-side scripts which sometimes have registration forms, large survey forms, etc. During testing our engineers might have to fill out a form 200-300 times a day, and this, of course, is a boring and tedious process ;)
That&#8217;s why we developed a quick but very useful jQuery plugin which prevent [...]]]></description>
			<content:encoded><![CDATA[<p>Our team often works on developing server-side scripts which sometimes have registration forms, large survey forms, etc. During testing our engineers might have to fill out a form 200-300 times a day, and this, of course, is a boring and tedious process ;)<span id="more-1157"></span></p>
<p>That&#8217;s why we developed a quick but very useful jQuery plugin which prevent the developer from having to fill out the form manually during testing.  It automatically detects forms in your document and saves your filling preference. The jFiller plugin also provides proper data for the different types of fields: radio buttons, check boxes, text inputs, textareas, selects, etc. The only field type we cannot provide automatic data filling for is the file upload field, but the reason is obvious, right? :)</p>
<p>And at the end it won&#8217;t require any modifications, you just include it and use it. When the debug phase is complete, you can simply exclude it from your HTML document. We like this automatic form filling script, and hope others will find it useful during development too.</p>
<h2>How to Use</h2>
<p>1.) <a title="Download jFiller jQuery Plugin" href="http://www.ajaxblender.com/script-sources/jfiller/download/jfiller.zip" target="_blank">Download</a> jFiller script. The package already contains jQuery framework.<br />
2.) Add the following code to your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag to connect jQuery framework and jFiller plugin. <em>(Make sure paths to files are correct.)</em></p>
<pre class="html">
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;jquery.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;jquery.cookie.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;jfiller.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlOtherTag">&lt;style type=<span class="htmlAttributeValue">&quot;text/css&quot;</span> media=<span class="htmlAttributeValue">&quot;screen&quot;</span>&gt;</span>
    @import url(&quot;jfiller.css&quot;);
<span class="htmlOtherTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span>
$(document).ready(function() {
    $(&#039;form&#039;).FillIt();
});
<span class="htmlScriptTag">&lt;/script&gt;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1157&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/jfiller.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jShaker</title>
		<link>http://www.ajaxblender.com/jshaker.html</link>
		<comments>http://www.ajaxblender.com/jshaker.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 15:18:19 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Effects]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[shake]]></category>
		<category><![CDATA[vibrate]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1142</guid>
		<description><![CDATA[jShaker is a simple jQuery plugin which runs a shake, vibrate effect on a selected web page element and all its children emulating an shaker effect. 
Why jShaker? Well, we added a new guy to the ajaxBlender team and one of his tasks was to create several sample jQuery plugins. The jShaker is one of [...]]]></description>
			<content:encoded><![CDATA[<p>jShaker is a simple jQuery plugin which runs a shake, vibrate effect on a selected web page element and all its children emulating an shaker effect. <span id="more-1142"></span></p>
<p>Why jShaker? Well, we added a new guy to the ajaxBlender team and one of his tasks was to create several sample jQuery plugins. The jShaker is one of them, but we don&#8217;t think the script will find a real use. (Actually we’d be surprised if you do. So, please share links with us.) We posted it, because it’s still a good little learning script.</p>
<p>Please note that the script will shake every children element of the parent running jShaker, and obviously the browser may slow down if there are a lot of nested elements, so be careful.  ;)</p>
<h3>Features</h3>
<ol>
<li>Light-weight script</li>
<li>Easy to integrate</li>
<li>Works with all modern browsers</li>
</ol>
<h3>How to Use</h3>
<p>1.) <a title="Download jShaker jQuery Plugin" href="http://www.ajaxblender.com/script-sources/jshaker/download/jshaker.zip">Download</a> jShaker script. The package already contains the jQuery framework.</p>
<p>2.) Add the following code to your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag to connect the jQuery framework and the jShaker plugin. <em>(Make sure your paths to the files are correct.)</em></p>
<pre class="html">
<span class="htmlScriptTag">&lt;script src=<span class="htmlAttributeValue">&quot;../jquery-1.4.2.min.js&quot;</span> type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span> <span class="htmlScriptTag">&lt;script src=<span class="htmlAttributeValue">&quot;../jshaker.js&quot;</span> type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
</pre>
<p>3.) jShaker plugin will extend the jQuery function so that you can call it on any element such as:</p>
<pre class="html">
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span>// <span class="htmlOtherTag">&lt;![CDATA[
$(document).ready(function(){
   $(&#039;.block&#039;).click(function(){
       $(this).jshaker();
   });
});
// ]]&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1142&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/jshaker.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>jNiceIt</title>
		<link>http://www.ajaxblender.com/jniceit.html</link>
		<comments>http://www.ajaxblender.com/jniceit.html#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:25:23 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1136</guid>
		<description><![CDATA[jNiceIt is a jQuery plugin which allows you to customize generic form controls and apply your customized design to them. You may use this plugin to emulate MS Windows, Linux or Apple MacOS controls or your own unique style.
Design of each control can be fully customized via CSS. The plugin supports both fixed and fluid [...]]]></description>
			<content:encoded><![CDATA[<p>jNiceIt is a jQuery plugin which allows you to customize generic form controls and apply your customized design to them. You may use this plugin to emulate MS Windows, Linux or Apple MacOS controls or your own unique style.<span id="more-1136"></span></p>
<p>Design of each control can be fully customized via CSS. The plugin supports both fixed and fluid page layouts because it does not use absolute positioning of skinned controls like most jNiceIt alternatives do.</p>
<h3>Features</h3>
<ol>
<li>Light-weight script</li>
<li>Easy to integrate</li>
<li>Fully customizable via CSS</li>
<li>Works with all modern browsers</li>
<li>Supports fixed and fluid page layouts</li>
<li>The following controls supported:
<ol>
<li>Button</li>
<li>Text Input</li>
<li>Check Box</li>
<li>Radio Button</li>
<li>File Upload Input</li>
<li>Select Box</li>
<li>List</li>
<li>Text Area</li>
</ol>
</li>
</ol>
<h3>How to Use</h3>
<p>1.) <a title="Download jNiceIt jQuery Plugin" href="http://www.ajaxblender.com/script-sources/jniceit/download/jniceit.zip">Download</a> jNiceIt script. The package already contains jQuery framework.</p>
<p>2.) Add the following code to your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag to connect jQuery framework and jNiceIt plugin. <em>(Make sure paths to files are correct.)</em></p>
<pre class="html">
<span class="htmlStyleTag">&lt;style type=<span class="cssString">&quot;text/css&quot;</span> media=<span class="cssString">&quot;screen&quot;</span>&gt;</span>
    <span class="cssImport">@import url(<span class="cssString">"../jniceit.css"</span>);</span>
<span class="htmlStyleTag">&lt;/style&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;../jquery-1.3.2.min.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;../jniceit.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span>
$(document).ready(function() {
    //    This will skin the form with class &#039;.NiceIt&#039;
    $(&#039;form.NiceIt&#039;).NiceIt();
});
<span class="htmlScriptTag">&lt;/script&gt;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1136&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/jniceit.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>How to Add Hints &amp; Auto Focus Form Fields using jQuery</title>
		<link>http://www.ajaxblender.com/howto-add-hints-form-auto-focus-using-javascript.html</link>
		<comments>http://www.ajaxblender.com/howto-add-hints-form-auto-focus-using-javascript.html#comments</comments>
		<pubDate>Fri, 19 Feb 2010 15:52:16 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1128</guid>
		<description><![CDATA[This tutorial teaches you how to easily add hints to your forms and auto focus fields.
We are continuing a series of quick articles for web developers which explain how to automate things during website programming. Today we will talk about forms and two usability items the every current website should have:

Auto Focus Fields. The first [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial teaches you how to easily add hints to your forms and auto focus fields.<span id="more-1128"></span></p>
<p>We are continuing a series of quick articles for web developers which explain how to automate things during website programming. Today we will talk about forms and two usability items the every current website should have:</p>
<ul>
<li><strong>Auto Focus Fields.</strong> The first field in the form should be focused by default, so that the user can start entering his password or name right after page loaded and would not have to click the field to start typing. This is a small and obvious usability items, but still a very important one.</li>
<li><strong>Hints.</strong> Forms should have quick tips for fields which requires entering data in a specific format (for example email address, phone number, date / time, etc.)</li>
</ul>
<p>So, let&#8217;s say our website have this contact form:</p>
<p><img title="screen-1" src="../wp-content/uploads/2010/02/screen-1.gif" alt="screen-1" width="370" height="218" /></p>
<h3>Auto Focus</h3>
<p>Full Name &#8211; this field will be automatically focused when the page loads, here is how it will be coded in the markup:</p>
<pre class="html">
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> name=<span class="htmlAttributeValue">&quot;fullname&quot;</span> id=<span class="htmlAttributeValue">&quot;fullname&quot;</span> class=<span class="htmlAttributeValue">&quot;auto-focus&quot;</span> /&gt;</span>
</pre>
<p>Notice the field has &#8216;auto-focus&#8217; class. This is so that any field in the form with this CSS class will be automatically focused on page load.</p>
<p>The auto focus can be implemented in JavaScript:</p>
<pre class="php">
$<span class="phpOperator">(</span><span class="phpString">'<span class="phpOperator">.</span>auto-focus<span class="phpOperator">:</span>first'</span><span class="phpOperator">)</span>.focus<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>2.) Email Address (the same for phone number and message fields) &#8211; If the field does not contain any value it will show a quick tip on the required data format. When the user clicks the field, the tip will disappear and let the user enter data. Here is how it will look in the markup:</p>
<pre class="html">
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> name=<span class="htmlAttributeValue">&quot;email&quot;</span> id=<span class="htmlAttributeValue">&quot;email&quot;</span> title=<span class="htmlAttributeValue">&quot;i.e. me@example.com&quot;</span> class=<span class="htmlAttributeValue">&quot;auto-hint&quot;</span> /&gt;</span>
</pre>
<p>As you see, our hint will be stored in &#8216;title&#8217; attribute of the field. This will let user see it when the field already contains a value in it.</p>
<p>By default, the color of text in input field will be black, we need to differentiate the color of the hint and common input value. Let&#8217;s set this color in CSS:</p>
<pre class="html">
<span class="htmlStyleTag">&lt;style type=<span class="cssString">&quot;text/css&quot;</span>&gt;</span>
    <span class="cssSelector">.auto-hint {</span> <span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue"> #AAAAAA</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="htmlStyleTag">&lt;/style&gt;</span>
</pre>
<p>Now we move to JavaScript implementation. At first we should display the hint in fields which have empty values:</p>
<pre class="php">
$<span class="phpOperator">(</span><span class="phpString">'INPUT<span class="phpOperator">.</span>auto-hint, TEXTAREA<span class="phpOperator">.</span>auto-hint'</span><span class="phpOperator">)</span>.focus<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
        $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpString">''</span><span class="phpOperator">)</span><span class="phpText">;</span>
        $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.removeClass<span class="phpOperator">(</span><span class="phpString">'auto-hint'</span><span class="phpOperator">)</span><span class="phpText">;</span>
    <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>And handle focus / blur events:</p>
<pre class="php">
$<span class="phpOperator">(</span><span class="phpString">'INPUT<span class="phpOperator">.</span>auto-hint, TEXTAREA<span class="phpOperator">.</span>auto-hint'</span><span class="phpOperator">)</span>.blur<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpString">''</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span> <span class="phpOperator">!</span><span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
       $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
       $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.addClass<span class="phpOperator">(</span><span class="phpString">'auto-hint'</span><span class="phpOperator">)</span><span class="phpText">;</span>
    <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
$<span class="phpOperator">(</span><span class="phpString">'INPUT<span class="phpOperator">.</span>auto-hint, TEXTAREA<span class="phpOperator">.</span>auto-hint'</span><span class="phpOperator">)</span>.<span class="phpFunction">each</span><span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpString">''</span><span class="phpOperator">)</span><span class="phpOperator">{</span><span class="phpKeyword"> return<span class="phpText">;</span></span> <span class="phpOperator">}</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpString">''</span><span class="phpOperator">)</span><span class="phpOperator">{</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpOperator">}</span>
   <span class="phpKeyword"> else </span><span class="phpOperator">{</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.removeClass<span class="phpOperator">(</span><span class="phpString">'auto-hint'</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>That&#8217;s it! ;) Click the <strong>Demo</strong> button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1128&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-add-hints-form-auto-focus-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>jSnow</title>
		<link>http://www.ajaxblender.com/jsnow.html</link>
		<comments>http://www.ajaxblender.com/jsnow.html#comments</comments>
		<pubDate>Thu, 17 Dec 2009 15:21:33 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Effects]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquery effects]]></category>
		<category><![CDATA[snow effect]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1119</guid>
		<description><![CDATA[Adding an animation effect of falling snow with JavaScript is a quick and easy way to keep your site looking current during the holidays for your site’s users. jSnow, is a jQuery plug-in that adds falling snow effect to your website. jSnow is lightweight (2kb), doesn&#8217;t require any external files to run (css or images) [...]]]></description>
			<content:encoded><![CDATA[<p>Adding an animation effect of falling snow with JavaScript is a quick and easy way to keep your site looking current during the holidays for your site’s users. jSnow, is a jQuery plug-in that adds falling snow effect to your website. jSnow is lightweight (2kb), doesn&#8217;t require any external files to run (css or images) and it&#8217;s very easy to use.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1119&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/jsnow.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Convert Images to Grayscale</title>
		<link>http://www.ajaxblender.com/howto-convert-image-to-grayscale-using-javascript.html</link>
		<comments>http://www.ajaxblender.com/howto-convert-image-to-grayscale-using-javascript.html#comments</comments>
		<pubDate>Mon, 07 Dec 2009 15:33:03 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[beginner guide]]></category>
		<category><![CDATA[desaturate]]></category>
		<category><![CDATA[grayscale]]></category>
		<category><![CDATA[image effects]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1113</guid>
		<description><![CDATA[Read this tutorial to find out how to desaturate an image (convert color images to grayscale) using JavaScript. A cross-browser code sample is supplied.
Recently we published a tutorial explaining how to rotate images using JavaScript. To continue this series of tutorials on image manipulation using JavaScript, we would like to explain how to change color [...]]]></description>
			<content:encoded><![CDATA[<p>Read this tutorial to find out how to desaturate an image (convert color images to grayscale) using JavaScript. A cross-browser code sample is supplied.<span id="more-1113"></span><br />
Recently we published a tutorial explaining <a title="How to Rotate Images using JavaScript" href="http://www.ajaxblender.com/howto-rotate-image-using-javascript-canvas.html" target="_blank">how to rotate images using JavaScript</a>. To continue this series of tutorials on image manipulation using JavaScript, we would like to explain how to change color images to grayscale using JavaScript.</p>
<p>This is a relatively simple task, but there are two methods (one method for Internet Explorer and one method for all other browsers).</p>
<h3>Canvas Method</h3>
<p>As you probably know, screen color consists of 3 components: red, green and blue. Each component or color (for example, red) has a value from 0 to 255. The value 0 indicates there is no red color and the value 255 would be the brightest possible red color. To convert a color to grayscale you just need to calculate the average for all three components. This can be done using the simple formula below:</p>
<pre class="php">
grayscalecolor <span class="phpOperator">=</span> <span class="phpOperator">(</span>red <span class="phpOperator">+</span> green <span class="phpOperator">+</span> blue<span class="phpOperator">)</span> / 3;
</pre>
<p>All modern browsers support the CANVAS tag which is allowed access to the image’s pixels. The code below will go through each pixel in the image and replace the color values with an average value. Here is the code:</p>
<pre class="php">
<span class="phpKeyword">
var </span>canvas <span class="phpOperator">=</span> document.createElement<span class="phpOperator">(</span><span class="phpString">'canvas'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
var </span>canvasContext <span class="phpOperator">=</span> canvas<span class="phpOperator">.</span>getContext<span class="phpOperator">(</span><span class="phpString">'2d'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
var </span>imgW <span class="phpOperator">=</span> imgObj<span class="phpOperator">.</span>width<span class="phpText">;</span>
<span class="phpKeyword">
var </span>imgH <span class="phpOperator">=</span> imgObj<span class="phpOperator">.</span>height;
canvas<span class="phpOperator">.</span>width <span class="phpOperator">=</span> imgW<span class="phpText">;</span>
canvas<span class="phpOperator">.</span>height <span class="phpOperator">=</span> imgH<span class="phpText">;</span>
canvasContext.drawImage<span class="phpOperator">(</span>imgObj, <span class="phpNumber">0</span>, <span class="phpNumber">0</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
var </span>imgPixels <span class="phpOperator">=</span> canvasContext.getImageData<span class="phpOperator">(</span><span class="phpNumber">0</span>, <span class="phpNumber">0</span>, imgW, imgH<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
for<span class="phpOperator">(</span></span>>var y <span class="phpOperator">=</span> 0; y <span class="phpOperator">&lt;</span> imgPixels<span class="phpOperator">.</span>height; y<span class="phpOperator"><span class="phpOperator">+</span><span class="phpOperator">+</span></span><span class="phpOperator">)</span><span class="phpOperator">{</span>
    <span class="phpKeyword"> for<span class="phpOperator">(</span></span>>var x <span class="phpOperator">=</span> 0; x <span class="phpOperator">&lt;</span> imgPixels<span class="phpOperator">.</span>width<span class="phpText">;</span> x<span class="phpOperator"><span class="phpOperator">+</span><span class="phpOperator">+</span></span><span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> var </span>i <span class="phpOperator">=</span> <span class="phpOperator">(</span>y * <span class="phpNumber">4</span><span class="phpOperator">)</span> * imgPixels<span class="phpOperator">.</span>width <span class="phpOperator">+</span> x * <span class="phpNumber">4</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>avg <span class="phpOperator">=</span> <span class="phpOperator">(</span>imgPixels<span class="phpOperator">.</span>data<span class="phpOperator">[</span>i<span class="phpOperator">]</span> <span class="phpOperator">+</span> imgPixels<span class="phpOperator">.</span>data<span class="phpOperator">[</span>i <span class="phpOperator">+</span> <span class="phpNumber">1</span><span class="phpOperator">]</span> <span class="phpOperator">+</span> imgPixels<span class="phpOperator">.</span>data<span class="phpOperator">[</span>i <span class="phpOperator">+</span> <span class="phpNumber">2</span><span class="phpOperator">]</span><span class="phpOperator">)</span> / 3;
          imgPixels<span class="phpOperator">.</span>data<span class="phpOperator">[</span>i<span class="phpOperator">]</span> <span class="phpOperator">=</span> avg;
          imgPixels<span class="phpOperator">.</span>data<span class="phpOperator">[</span>i <span class="phpOperator">+</span> <span class="phpNumber">1</span><span class="phpOperator">]</span> <span class="phpOperator">=</span> avg;
          imgPixels<span class="phpOperator">.</span>data<span class="phpOperator">[</span>i <span class="phpOperator">+</span> <span class="phpNumber">2</span><span class="phpOperator">]</span> <span class="phpOperator">=</span> avg;
     <span class="phpOperator">}</span>
<span class="phpOperator">}</span>
canvasContext.putImageData<span class="phpOperator">(</span>imgPixels, <span class="phpNumber">0</span>, <span class="phpNumber">0</span>, <span class="phpNumber">0</span>, <span class="phpNumber">0</span>, imgPixels<span class="phpOperator">.</span>width, imgPixels<span class="phpOperator">.</span>height<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
return </span>canvas<span class="phpOperator">.</span>toDataURL<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>From the above code sample, you see that we created a canvas, loaded the image into it, and then changed the color values of each pixel in the image to an average value. After that we simply replaced the SRC of our image to the image changed in the canvas.</p>
<p>Using the same method you can also flip images using JavaScript. (We will create a tutorial for this in the future).</p>
<h3>MSIE (Internet Explorer) method</h3>
<p>Microsoft Internet Explorer does not support the CANVAS tag, but Microsoft does provide image manipulation through filters. The filter to use for converting images to grayscale is the filter named <strong>DXImageTransform.Microsoft.BasicImage</strong>. Therefore, we simply apply this filter to our image, and it will work in all versions of MSIE (starting from version 6).</p>
<pre class="php">
imgObj<span class="phpOperator">.</span>style.filter <span class="phpOperator">=</span> <span class="phpString">'progid<span class="phpOperator">:</span>DXImageTransform<span class="phpOperator">.</span>Microsoft.BasicImage<span class="phpOperator">(</span>grayScale=<span class="phpNumber">1</span><span class="phpOperator">)</span>'</span><span class="phpText">;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1113&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-convert-image-to-grayscale-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Rotate Images Using JavaScript</title>
		<link>http://www.ajaxblender.com/howto-rotate-image-using-javascript-canvas.html</link>
		<comments>http://www.ajaxblender.com/howto-rotate-image-using-javascript-canvas.html#comments</comments>
		<pubDate>Mon, 30 Nov 2009 17:32:19 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1100</guid>
		<description><![CDATA[Rotate images using JavaScript &#8211; is this even possible? Of course ;) Read this tutorial to find out how to rotate images using JavaScript, and the code is a cross-browser solution.
Ok, let&#8217;s start from the easiest part. Let&#8217;s say we have the following markup:

&#60;img src=&#34;/article-sources/images/plane-1.jpg&#34; alt=&#34;&#34; id=&#34;image&#34; /&#62;
&#60;canvas id=&#34;canvas&#34;&#62;&#60;/canvas&#62;

The markup above adds the image that [...]]]></description>
			<content:encoded><![CDATA[<p>Rotate images using JavaScript &#8211; is this even possible? Of course ;) Read this tutorial to find out how to rotate images using JavaScript, and the code is a cross-browser solution.<span id="more-1100"></span></p>
<p>Ok, let&#8217;s start from the easiest part. Let&#8217;s say we have the following markup:</p>
<pre class="html">
<span class="htmlImageTag">&lt;img src=<span class="htmlAttributeValue">&quot;/article-sources/images/plane-1.jpg&quot;</span> alt=<span class="htmlAttributeValue">&quot;&quot;</span> id=<span class="htmlAttributeValue">&quot;image&quot;</span> /&gt;</span>
<span class="htmlOtherTag">&lt;canvas id=<span class="htmlAttributeValue">&quot;canvas&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/canvas&gt;</span>
</pre>
<p>The markup above adds the image that we will rotate and the <strong>CANVAS </strong>tag (which is used to display the rotated image). The CANVAS tag only works for current browsers such as FF, Opera, Chrome, IE8 and Safari. IE 6 and IE 7 do not support the CANVAS tag, so that we will remove it if browser is IE.</p>
<p>Now let’s review how we will rotate the image. Most current browsers supports the <strong>&lt;canvas&gt;</strong> object which actually allows for &#8216;rotate&#8217; and &#8216;drawImage&#8217; methods in 2D context, but the IE 6 and IE7 will not recognize this tag. So Microsoft invented rotation using their filters via <strong>DXImageTransform.Microsoft.BasicImage</strong> (here is a <a href="http://msdn.microsoft.com/en-us/library/ms532918%28VS.85%29.aspx" target="_blank">quick link to MSDN</a>). The good news is that the filter works and is easy to use, but the bad news is that it supports only 4 angles (0, 90, 180 and 270 degrees). The code to rotate images for IE will look like this:</p>
<pre class="php">
<span class="phpComment">//  Use DXImageTransform<span class="phpOperator">.</span>Microsoft.BasicImage filter<span class="phpKeyword"> for </span>MSIE
</span>>switch<span class="phpOperator">(</span>degree<span class="phpOperator">)</span><span class="phpOperator">{</span>
    <span class="phpKeyword"> case </span><span class="phpNumber">0</span><span class="phpOperator">:</span> image.style.filter <span class="phpOperator">=</span> <span class="phpString">'progid<span class="phpOperator">:</span>DXImageTransform<span class="phpOperator">.</span>Microsoft.BasicImage<span class="phpOperator">(</span>rotation<span class="phpOperator">=</span><span class="phpNumber">0</span><span class="phpOperator">)</span>'</span><span class="phpText">;</span><span class="phpKeyword"> break<span class="phpText">;</span></span>
    <span class="phpKeyword"> case </span>90<span class="phpOperator">:</span> image.style.filter <span class="phpOperator">=</span> <span class="phpString">'progid<span class="phpOperator">:</span>DXImageTransform<span class="phpOperator">.</span>Microsoft.BasicImage<span class="phpOperator">(</span>rotation<span class="phpOperator">=</span><span class="phpNumber">1</span><span class="phpOperator">)</span>'</span><span class="phpText">;</span><span class="phpKeyword"> break<span class="phpText">;</span></span>
    <span class="phpKeyword"> case </span>180<span class="phpOperator">:</span> image.style.filter <span class="phpOperator">=</span> <span class="phpString">'progid<span class="phpOperator">:</span>DXImageTransform<span class="phpOperator">.</span>Microsoft.BasicImage<span class="phpOperator">(</span>rotation<span class="phpOperator">=</span><span class="phpNumber">2</span><span class="phpOperator">)</span>'</span><span class="phpText">;</span><span class="phpKeyword"> break<span class="phpText">;</span></span>
    <span class="phpKeyword"> case </span>270<span class="phpOperator">:</span> image.style.filter <span class="phpOperator">=</span> <span class="phpString">'progid<span class="phpOperator">:</span>DXImageTransform<span class="phpOperator">.</span>Microsoft.BasicImage<span class="phpOperator">(</span>rotation<span class="phpOperator">=</span><span class="phpNumber">3</span><span class="phpOperator">)</span>'</span><span class="phpText">;</span><span class="phpKeyword"> break<span class="phpText">;</span></span>
<span class="phpOperator">}</span>
</pre>
<p>And for browsers that support the CNAVAS tag, the code will look like this:</p>
<pre class="php">
<span class="phpKeyword">
var </span>cContext <span class="phpOperator">=</span> canvas<span class="phpOperator">.</span>getContext<span class="phpOperator">(</span><span class="phpString">'2d'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
var </span>cw <span class="phpOperator">=</span> img<span class="phpOperator">.</span>width, ch <span class="phpOperator">=</span> img<span class="phpOperator">.</span>height, cx <span class="phpOperator">=</span> <span class="phpNumber">0</span>, cy <span class="phpOperator">=</span> 0;
<span class="phpComment">//   Calculate<span class="phpKeyword"> new </span>canvas size and x/y coorditates<span class="phpKeyword"> for </span>image
</span>>switch<span class="phpOperator">(</span>degree<span class="phpOperator">)</span><span class="phpOperator">{</span>
    <span class="phpKeyword"> case </span>90<span class="phpOperator">:</span>
          cw <span class="phpOperator">=</span> img<span class="phpOperator">.</span>height;
          ch <span class="phpOperator">=</span> img<span class="phpOperator">.</span>width<span class="phpText">;</span>
          cy <span class="phpOperator">=</span> img<span class="phpOperator">.</span>height * <span class="phpOperator">(</span>-<span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> break<span class="phpText">;</span></span>
    <span class="phpKeyword"> case </span>180<span class="phpOperator">:</span>
          cx <span class="phpOperator">=</span> img<span class="phpOperator">.</span>width * <span class="phpOperator">(</span>-<span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpText">;</span>
          cy <span class="phpOperator">=</span> img<span class="phpOperator">.</span>height * <span class="phpOperator">(</span>-<span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> break<span class="phpText">;</span></span>
    <span class="phpKeyword"> case </span>270<span class="phpOperator">:</span>
          cw <span class="phpOperator">=</span> img<span class="phpOperator">.</span>height;
          ch <span class="phpOperator">=</span> img<span class="phpOperator">.</span>width<span class="phpText">;</span>
          cx <span class="phpOperator">=</span> img<span class="phpOperator">.</span>width * <span class="phpOperator">(</span>-<span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> break<span class="phpText">;</span></span>
<span class="phpOperator">}</span>
<span class="phpComment">//  Rotate image
</span>canvas<span class="phpOperator">.</span>setAttribute<span class="phpOperator">(</span><span class="phpString">'width'</span>, cw<span class="phpOperator">)</span><span class="phpText">;</span>
canvas<span class="phpOperator">.</span>setAttribute<span class="phpOperator">(</span><span class="phpString">'height'</span>, ch<span class="phpOperator">)</span><span class="phpText">;</span>
cContext.rotate<span class="phpOperator">(</span>degree * Math<span class="phpOperator">.</span>PI / 180<span class="phpOperator">)</span><span class="phpText">;</span>
cContext.drawImage<span class="phpOperator">(</span>img, cx, cy<span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>We have to change the X/Y coordinates for drawImage function. Otherwise it will not be visible in the viewport (see Figure B versus Figure C on the illustration below).</p>
<p><img class="alignnone size-full wp-image-1101" title="image-rotation-canvas-illustration" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/image-rotation-canvas-illustration.gif" alt="image-rotation-canvas-illustration" width="581" height="420" /></p>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1100&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-rotate-image-using-javascript-canvas.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Create Custom Cursors without .cur File</title>
		<link>http://www.ajaxblender.com/howto-create-custom-image-cursors.html</link>
		<comments>http://www.ajaxblender.com/howto-create-custom-image-cursors.html#comments</comments>
		<pubDate>Wed, 25 Nov 2009 14:33:10 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1095</guid>
		<description><![CDATA[Sometimes you may want to replace your cursor with a custom image or use a custom image to move with your cursor. This quick JavaScript tutorial will show you how to implement it.
The task is pretty simple. At first we should hide the default cursor for the section where we will display our custom one. [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may want to replace your cursor with a custom image or use a custom image to move with your cursor. This quick JavaScript tutorial will show you how to implement it.<span id="more-1095"></span><br />
The task is pretty simple. At first we should hide the default cursor for the section where we will display our custom one. Our custom cursor will actually be a DIV with an image on the background. We will use JavaScript to change the position of this DIV when the user moves the mouse over the section.</p>
<h3>The markup</h3>
<pre class="html">
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;test-area&quot;</span>&gt;</span>
     Move mouse over this area.
<span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;mycursor&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
</pre>
<p>The <strong>#test-area</strong> will be the section with our custom cursor to appear and the <strong>#mycursor</strong> will be the actual DIV with the custom cursor image. Here are a few lines of CSS code to stylize the markup:</p>
<pre class="css">
<span class="cssSelector">#test-area {</span>
     <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 200px</span><span class="cssRest">;</span>
     <span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue"> 3px dashed #CCCCCC</span><span class="cssRest">;</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> #FFFFFF</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 20px</span><span class="cssRest">;</span>
     <span class="cssProperty">cursor</span><span class="cssRest">:</span><span class="cssValue"> url(./blank.cur), none</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">#mycursor {</span>
     <span class="cssProperty">cursor</span><span class="cssRest">:</span><span class="cssValue"> none</span><span class="cssRest">;</span>
     <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue"> 97px</span><span class="cssRest">;</span>
     <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 137px</span><span class="cssRest">;</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> url(<span class="cssString">"/article-sources/images/pointer-cursor.gif"</span>) no-repeat left top</span><span class="cssRest">;</span>
     <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue"> absolute</span><span class="cssRest">;</span>
     <span class="cssProperty">display</span><span class="cssRest">:</span><span class="cssValue"> none</span><span class="cssRest">;</span>
     <span class="cssProperty">top</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">left</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">z-index</span><span class="cssRest">:</span><span class="cssValue"> 10000</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>The code (we hope) is crystal clear but let&#8217;s stop to review one aspect. In the #test-area you see the &#8216;cursor: …&#8217; declaration. We will use this to hide the default browser cursor. The easiest way to do so is to load a blank cursor (you may <a href="http://www.ajaxblender.com/article-sources/jquery/custom-cursors/blank.cur" target="_blank">download it here</a>), but this unfortunately will not work in Chrome &amp; Opera. It will display a black rectangle in Chrome and a default pointer cursor in Opera. But since this tutorial covers other important aspects related to cursor behavior (such as how to handle mouse movement, etc.), it is still a useful topic to cover for those just starting to learn JavaScript programming. So, let&#8217;s continue ;).</p>
<p>The finishing part is to add a few lines of JavaScript code for jQuery to make our arrow follow the cursor.</p>
<pre class="php">
<span class="phpOperator">&lt;</span>script type=<span class="phpString">"text/javascript"</span><span class="phpOperator">&gt;</span>
     $<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          $<span class="phpOperator">(</span><span class="phpString">'#test-area'</span><span class="phpOperator">)</span>.mouseout<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span><span class="phpString">'#mycursor'</span><span class="phpOperator">)</span>.hide<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
              <span class="phpKeyword"> return </span>>false<span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
          $<span class="phpOperator">(</span><span class="phpString">'#test-area'</span><span class="phpOperator">)</span>.mouseenter<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span><span class="phpString">'#mycursor'</span><span class="phpOperator">)</span>.show<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
              <span class="phpKeyword"> return </span>>false<span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
          $<span class="phpOperator">(</span><span class="phpString">'#test-area'</span><span class="phpOperator">)</span>.mousemove<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>e<span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span><span class="phpString">'#mycursor'</span><span class="phpOperator">)</span>.css<span class="phpOperator">(</span><span class="phpString">'left'</span>, e.clientX - 20<span class="phpOperator">)</span>.css<span class="phpOperator">(</span><span class="phpString">'top'</span>, e.clientY <span class="phpOperator">+</span> <span class="phpNumber">7</span><span class="phpOperator">)</span><span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">&lt;</span>/script<span class="phpOperator">&gt;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1095&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-create-custom-image-cursors.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

