<?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>Thu, 03 Jun 2010 15:20:57 +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>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>1</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>1</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>4</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>2</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>1</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>10</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>3</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>1</slash:comments>
		</item>
		<item>
		<title>jAni</title>
		<link>http://www.ajaxblender.com/jani.html</link>
		<comments>http://www.ajaxblender.com/jani.html#comments</comments>
		<pubDate>Mon, 23 Nov 2009 16:05:22 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Effects]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[background animate]]></category>
		<category><![CDATA[image effects]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1090</guid>
		<description><![CDATA[jAni is a simple plugin for jQuery which allows you animate background images. The plugin is basically an alternative to the animated GIF but with several benefits. At first, it&#8217;s always better to use an animated GIF as this format is supported by all browsers without any JavaScript code or additional markup, but the &#8220;dark [...]]]></description>
			<content:encoded><![CDATA[<p>jAni is a simple plugin for jQuery which allows you animate background images. The plugin is basically an alternative to the animated GIF but with several benefits.<span id="more-1090"></span> At first, it&#8217;s always better to use an animated GIF as this format is supported by all browsers without any JavaScript code or additional markup, but the &#8220;dark side&#8221; of it is that an animated GIF allows only 256 colors and you cannot control animation in any way. The jAni loads a long vertical image and changes its background position with the speed you setup, giving you more control of the animation.</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>
</ol>
<h3>How to Use</h3>
<p>1.) <a href="http://www.ajaxblender.com/script-sources/jani/download/jani.zip">Download</a> jAni 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 the jQuery framework and jAni 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-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;../jani.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
</pre>
<p>3.) Add a style containing the url to your background with animation (this may be added to a separate CSS document or inside the <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag):</p>
<pre class="html">
<span class="htmlStyleTag">&lt;style type=<span class="cssString">&quot;text/css&quot;</span>&gt;</span>
<span class="cssSelector">.animation-1 {</span>
<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> url(./images/sample-animation.gif) no-repeat left top</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="htmlStyleTag">&lt;/style&gt;</span>
</pre>
<p>4.) Add an empty DIV which will display animation in your document:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;animation-1&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
</pre>
<p>5.) Add the following code to your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag to initialize jAni and start the animation.</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">'#animation-<span class="phpNumber">1</span>'</span><span class="phpOperator">)</span>.jani<span class="phpOperator">(</span><span class="phpOperator">{</span> frameWidth<span class="phpOperator">:</span> 100, frameHeight<span class="phpOperator">:</span> 100, speed<span class="phpOperator">:</span> 100, totalFrames<span class="phpOperator">:</span> 19 <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
$<span class="phpOperator">(</span><span class="phpString">'#animation-<span class="phpNumber">1</span>'</span><span class="phpOperator">)</span>.jani<span class="phpOperator">.</span>play<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 see it in action.</p>
<h3>jAni Methods</h3>
<p><strong>jani.play()</strong><br />
Start playing animation.</p>
<p><strong>jani.pause()</strong><br />
Pause animation.</p>
<p><strong>jani.stop()</strong><br />
Stop animation.</p>
<h3>Parameters</h3>
<p>The table below contains a list of parameters accepted by the <strong>.jani()</strong> function.</p>
<table class="options" border="0">
<tbody>
<tr>
<th>Parameters</th>
<th>Description</th>
</tr>
<tr>
<td><strong>frameWidth</strong></td>
<td>Width of a single frame.</td>
</tr>
<tr class="odd">
<td><strong>frameHeight</strong></td>
<td>Height of a single frame.</td>
</tr>
<tr>
<td><strong>speed</strong></td>
<td>Animation speed.</td>
</tr>
<tr class="odd">
<td><strong>totalFrames</strong></td>
<td>Total frames in the animation.</td>
</tr>
<tr>
<td><strong>loop</strong></td>
<td>Loop an animation or not. By default, value is <em>true</em>.</td>
</tr>
</tbody>
</table>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1090&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/jani.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Convert ASCII Character to Hex, Decimal and Binary Code</title>
		<link>http://www.ajaxblender.com/howto-convert-ascii-hex-binary-decimal.html</link>
		<comments>http://www.ajaxblender.com/howto-convert-ascii-hex-binary-decimal.html#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:38:19 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1085</guid>
		<description><![CDATA[This JavaScript tutorial explains how to convert ASCII Character to Hex, Decimal and Binary Code using JavaScript. 
Recently we were asked for a function code to convert user input to hex code which was intended to be used in a JavaScript remote terminal application. We decided to share this code and also added two more [...]]]></description>
			<content:encoded><![CDATA[<p>This JavaScript tutorial explains how to convert ASCII Character to Hex, Decimal and Binary Code using JavaScript. <span id="more-1085"></span><br />
Recently we were asked for a function code to convert user input to hex code which was intended to be used in a JavaScript remote terminal application. We decided to share this code and also added two more conversion methods to it. The methods are Character to Decimal, Character to Binary, and Decimal to Hex.</p>
<p>The below code object contains the implementation of the various methods. We hope it will be useful to others, and you may use this code in your projects without any limitations. The code can be downloaded it in a separate file <a href="http://www.ajaxblender.com/article-sources/jquery/ascii-functions/convfunctions.js" target="_blank">here</a>.</p>
<pre class="php">
<span class="phpKeyword">
var </span>Convert <span class="phpOperator">=</span> <span class="phpOperator">{</span>
     chars<span class="phpOperator">:</span> <span class="phpString">" <span class="phpOperator">!</span>\"</span>#$%&#038;amp<span class="phpText">;</span><span class="phpString">'<span class="phpOperator">(</span><span class="phpOperator">)</span>*<span class="phpOperator">+</span>'</span>-<span class="phpOperator">.</span>/0123456789<span class="phpOperator">:</span><span class="phpText">;</span><span class="phpOperator">&lt;</span><span class="phpOperator"><span class="phpOperator">=</span><span class="phpOperator">&gt;</span></span><span class="phpOperator">?</span>@ABCDEFGHIJKLMNOPQRSTUVWXYZ<span class="phpOperator">[</span>\\<span class="phpOperator">]</span>^_`abcdefghijklmnopqrstuvwxyz<span class="phpOperator">{</span><span class="phpOperator">|</span><span class="phpOperator">}</span>~<span class="phpString">",
     hex<span class="phpOperator">:</span> <span class="phpString">'0123456789ABCDEF'</span>, bin<span class="phpOperator">:</span> <span class="phpOperator">[</span><span class="phpString">'0000'</span>, <span class="phpString">'0001'</span>, <span class="phpString">'0010'</span>, <span class="phpString">'0011'</span>, <span class="phpString">'0100'</span>, <span class="phpString">'0101'</span>, <span class="phpString">'0110'</span>, <span class="phpString">'0111'</span>, <span class="phpString">'1000'</span>, <span class="phpString">'1001'</span>, <span class="phpString">'1010'</span>, <span class="phpString">'1011'</span>, <span class="phpString">'1100'</span>, <span class="phpString">'1101'</span>, <span class="phpString">'1110'</span>, <span class="phpString">'1111'</span><span class="phpOperator">]</span>,
     decToHex<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>d<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> return </span><span class="phpOperator">(</span>this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span><span class="phpOperator">(</span>d - d % 16<span class="phpOperator">)</span>/16<span class="phpOperator">)</span> <span class="phpOperator">+</span> this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span>d % 16<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>,
     toBin<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> var </span>d <span class="phpOperator">=</span> this<span class="phpOperator">.</span>toDec<span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>l <span class="phpOperator">=</span> this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span>d % 16<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>h <span class="phpOperator">=</span> this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span><span class="phpOperator">(</span>d - d % 16<span class="phpOperator">)</span>/16<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>hhex <span class="phpOperator">=</span> "</span>ABCDEF&quot;<span class="phpText">;</span>
         <span class="phpKeyword"> var </span>lown <span class="phpOperator">=</span> l <span class="phpOperator">&lt;</span> 10 <span class="phpOperator">?</span> l <span class="phpOperator">:</span> <span class="phpOperator">(</span>10 <span class="phpOperator">+</span> hhex<span class="phpOperator">.</span>indexOf<span class="phpOperator">(</span>l<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>highn <span class="phpOperator">=</span> h <span class="phpOperator">&lt;</span> 10 <span class="phpOperator">?</span> h <span class="phpOperator">:</span> <span class="phpOperator">(</span>10 <span class="phpOperator">+</span> hhex<span class="phpOperator">.</span>indexOf<span class="phpOperator">(</span>h<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> return </span>this<span class="phpOperator">.</span>bin<span class="phpOperator">[</span>highn<span class="phpOperator">]</span> <span class="phpOperator">+</span> <span class="phpString">' '</span> <span class="phpOperator">+</span> this<span class="phpOperator">.</span>bin<span class="phpOperator">[</span>lown<span class="phpOperator">]</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>,
     toHex<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> return </span>this<span class="phpOperator">.</span>decToHex<span class="phpOperator">(</span>this<span class="phpOperator">.</span>toDec<span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>,
     toDec<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> var </span>p <span class="phpOperator">=</span> this<span class="phpOperator">.</span>chars<span class="phpOperator">.</span>indexOf<span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> return </span><span class="phpOperator">(</span>p <span class="phpOperator">&lt;</span><span class="phpOperator">=</span> -<span class="phpNumber">1</span><span class="phpOperator">)</span> <span class="phpOperator">?</span> <span class="phpNumber">0</span> <span class="phpOperator">:</span> <span class="phpOperator">(</span>p <span class="phpOperator">+</span> 32<span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpText">;</span>
</pre>
<p>Here is how to call the above code:</p>
<pre class="php">
<span class="phpComment">//  Convert Character to Binary <span class="phpOperator">(</span>it will<span class="phpKeyword"> return </span>0100 0001<span class="phpOperator">)</span><span class="phpText">;</span>
</span>Convert.toBin<span class="phpOperator">(</span><span class="phpString">'A'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">//  Convert Character to Hex <span class="phpOperator">(</span>it will<span class="phpKeyword"> return </span>41<span class="phpOperator">)</span><span class="phpText">;</span>
</span>Convert.toHex<span class="phpOperator">(</span><span class="phpString">'A'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">//  Convert Character to Dec <span class="phpOperator">(</span>it will<span class="phpKeyword"> return </span>65<span class="phpOperator">)</span><span class="phpText">;</span>
</span>Convert.toDec<span class="phpOperator">(</span><span class="phpString">'A'</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view it an action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1085&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-convert-ascii-hex-binary-decimal.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
