<?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>Vision Master Designs &#187; jQuery</title>
	<atom:link href="http://visionmasterdesigns.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://visionmasterdesigns.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 29 Oct 2009 20:00:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tutorial : Collapsible Menus using jQuery</title>
		<link>http://visionmasterdesigns.com/tutorial-collapsible-menus-using-jquery/</link>
		<comments>http://visionmasterdesigns.com/tutorial-collapsible-menus-using-jquery/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 07:00:36 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript Frameworks]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Collapsible Menus]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.visionmasterdesigns.com/?p=856</guid>
		<description><![CDATA[A simple tutorial to show how I have achieved a nice,smooth Collapsible Menu Effect used in this site. (Example : The Category section in the sidebar in this site).]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 0 0.6em 0.6em;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fvisionmasterdesigns.com%2Ftutorial-collapsible-menus-using-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fvisionmasterdesigns.com%2Ftutorial-collapsible-menus-using-jquery%2F&amp;source=rowoot&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>jQuery has surely made my life easier. I have been trying out both Prototype &amp; jQuery for a couple of days now and for some reason, I find jQuery a lil easier compared to Prototype Javascript Library. Although Prototype is a much powerful library (according to me), jQuery is just too simple <img src='http://visionmasterdesigns.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Anyways I will show you a simple effect which you already must have seen in many places.</p>
<p><strong>Demo :</strong> The Category section in the sidebar in this site.</p>
<p><em><strong>EDIT :</strong> Added Collapse All, Expand All Code as well</em><br />
<span id="more-856"></span><br />
This code can be extended in creating a full-fledged dynamic Collapsible Menu. Mainly you can use this code in you Blogs (if you have a large array of Categories) to group your categories/tags.</p>
<pre class="brush: javascript">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js&quot; &gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){

//Store Image paths
var toggleMinus = &#039;path/to/minus/image&#039;;
var togglePlus = &#039;path/to/plus/image&#039;;

var $subHead = $(&#039;.children&#039;).parent();

//Add the Plus image to every child by default
$subHead.prepend(&#039;&lt;img src=&quot;&#039; + togglePlus + &#039;&quot; alt=&quot;collapse this section&quot; /&gt; &#039;);

//By Default put the Menu in collapsed state
$(&#039;.children&#039;).parent().children(&#039;ul&#039;).slideUp(&#039;fast&#039;);

//Expand All Code
$(&#039;.expand&#039;).click(function() {
		$subHead.children(&#039;ul&#039;).slideDown(&#039;fast&#039;);
		$(&#039;img&#039;, $subHead).attr(&#039;src&#039;, toggleMinus);
});

//Contract All Code
$(&#039;.contract&#039;).click(function() {
		$subHead.attr(&#039;src&#039;, toggleMinus).children(&#039;ul&#039;).slideUp(&#039;fast&#039;);
		$(&#039;img&#039;, $subHead).attr(&#039;src&#039;, togglePlus);
});

//Expand or Contract one particular Nested ul
$(&#039;img&#039;, $subHead).addClass(&#039;clickable&#039;).click(function() {
var toggleSrc = $(this).attr(&#039;src&#039;);
if ( toggleSrc == toggleMinus ) {
$(this).attr(&#039;src&#039;, togglePlus).parent().children(&#039;ul&#039;).slideUp(&#039;fast&#039;);
} else{
$(this).attr(&#039;src&#039;, toggleMinus).parent().children(&#039;ul&#039;).slideDown(&#039;fast&#039;);
};
});
});
&lt;/script&gt;
</pre>
<p>Basically <span class="code">.children</span> can be kept same if you are planning to use this in your WordPress Blog (for Categories or any unordered list or ordered list since WordPress assigns class=children to nested lists)</p>
<p>If you want to use this code in some other form, then <span class="code">.children</span> has to be replaced with the class name of the nested list. For Example, the above code works for lists like</p>
<pre class="brush: html">
&lt;a href=&quot;javascript:void(0);&quot; class=&quot;expand&quot;&gt;Expand All&lt;/a&gt;
&lt;a href=&quot;javascript:void(0);&quot; class=&quot;contract&quot;&gt;Contract All&lt;/a&gt;
&lt;ul&gt;
	&lt;li&gt;Main 1
&lt;ul class=&quot;children&quot;&gt;
	&lt;li&gt;Sub 1&lt;/li&gt;
	&lt;li&gt;Sub 2&lt;/li&gt;
	&lt;li&gt;Sub 3&lt;/li&gt;
	&lt;li&gt;Sub 4&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
	&lt;li&gt;Main 2
&lt;ul class=&quot;children&quot;&gt;
	&lt;li&gt;Sub 1&lt;/li&gt;
	&lt;li&gt;Sub 2&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
	&lt;li&gt;Main 3&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>This is how it looks. (I haven`t added Expand All and Collapse All in the Demo Here)</p>
<ul>
<li>Main 1
<ul class="children">
<li>Sub 1</li>
<li>Sub 2</li>
<li>Sub 3</li>
<li>Sub 4</li>
</ul>
</li>
<li>Main 2
<ul class="children">
<li>Sub 1</li>
<li>Sub 2</li>
</ul>
</li>
<li>Main 3</li>
</ul>
<p>You can style the unordered list not to display the bullets using CSS which I haven`t shown above.</p>
<p>I hope you guys enjoyed this post. If you guys have any questions, your comments are welcome.<br />
Signing off.</p>
]]></content:encoded>
			<wfw:commentRss>http://visionmasterdesigns.com/tutorial-collapsible-menus-using-jquery/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Tutorial : AJAX interface/menu using jQuery/PHP</title>
		<link>http://visionmasterdesigns.com/tutorial-ajax-interface-menu-using-jqueryphp/</link>
		<comments>http://visionmasterdesigns.com/tutorial-ajax-interface-menu-using-jqueryphp/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 15:24:34 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript Frameworks]]></category>
		<category><![CDATA[PHP & MySQL]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.visionmasterdesigns.com/?p=218</guid>
		<description><![CDATA[Hello Guys, I have been busy with college lately, since this is my last year in college, I need to do a very cool project to get some good marks . Anyways that doesn`t mean I won`t be postin tutorials here . Want to present your data using AJAX/PHP/MySQL by just coding few lines ? [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 0 0.6em 0.6em;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fvisionmasterdesigns.com%2Ftutorial-ajax-interface-menu-using-jqueryphp%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fvisionmasterdesigns.com%2Ftutorial-ajax-interface-menu-using-jqueryphp%2F&amp;source=rowoot&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: center;"><a title="Ajax Interface" rel="lightbox[pics218]" href="http://www.visionmasterdesigns.com/blog/wp-content/uploads/2008/07/t1.jpg"><img class="attachment wp-att-219 centered" src="http://www.visionmasterdesigns.com/blog/wp-content/uploads/2008/07/t1.thumbnail.jpg" alt="Ajax Interface" width="350" height="180" /></a></p>
<p>Hello Guys,</p>
<p>I have been busy with college lately, since this is my last year in college, I need to do a very cool project to get some good marks <img src='http://visionmasterdesigns.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Anyways that doesn`t mean I won`t be postin tutorials here <img src='http://visionmasterdesigns.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Want to present your data using AJAX/PHP/MySQL by just coding few lines ? Well here it is. This tutorial teaches you how to present data using AJAX (using jQuery) with some neat effects. We can use PHP/MySQL to store the data and call it. In this tutorial I`ll teach you how to do so with PHP. So lets begin !</p>
<p>You can check the demo <a href="http://visionmasterdesigns.com/demo/ajaxinterface/" target="_blank">HERE</a>.<br />
You can download these files <a href="http://visionmasterdesigns.com/demo/ajaxinterface/interface.zip">HERE</a></p>
<h4>Index</h4>
<ol>
<li>Create the HTML page &#8211; <span class="code">index.html</span></li>
<li>
<ul>
<li><a href="http://www.visionmasterdesigns.com/2008/07/tutorial-ajax-interface-menu-using-jqueryphp/#css">The CSS</a></li>
<li><a href="http://www.visionmasterdesigns.com/2008/07/tutorial-ajax-interface-menu-using-jqueryphp/#html">The HTML</a></li>
<li><a href="http://www.visionmasterdesigns.com/2008/07/tutorial-ajax-interface-menu-using-jqueryphp/#javascript">The Javascript</a></li>
<li><a href="http://www.visionmasterdesigns.com/2008/07/tutorial-ajax-interface-menu-using-jqueryphp/#interface">Final interface.html page</a></li>
</ul>
</li>
<li>Create the PHP File &#8211; <span class="code">boo.php</span></li>
</ol>
<p><span id="more-218"></span></p>
<h2 align="center">HTML Page</h2>
<p>Our HTML file will contain the javascript as well as the CSS styles embedded within it. We can also create the effect by creating individual files for each i.e one for javascript functions and the other for the CSS. Anyways in this tutorial, both of them will be embedded within the html page. Now First fire up your favourite HTML editor (Personally I love Dreamweaver CS3).</p>
<p>We will be using The jQuery Framework &#8211; <span class="code">jquery.js</span>. If you want to know how the jQuery Framework works then do visit <a href="http://www.visionmasterdesigns.com/blog/2008/07/exploring-javascript-frameworks-jquery-126/">Exploring Javascript Frameworks : jQuery 1.2.6</a>.<br />
<!--adman--></p>
<h4><a name="css"></a>Step 1 &#8211; The CSS</h4>
<p>Lets add our css first. First create a new HTML file, call it <span class="code">interface.html</span>.<br />
The following is the css code.</p>
<pre class="brush: css">
&lt;style type=&quot;text/css&quot;&gt;
body { margin:0 auto 0 auto; color:#000; font-family:Georgia, &quot;Times New Roman&quot;, Times, serif; font-size:16px; background-color:#666666; }

.page { margin:100px auto 0 auto; width:750px;}

/*MENU START*/
#menu  { list-style:none; margin:0px; padding:0px;}

#menu li { list-style:none; display:inline; }
li.active a { background-color:#FFF;color:#000; }

#menu li a,#menu li a:link { float:left; background-color:#3c3c3c; margin-right:5px; padding:7px; color:#FFFFFF; text-decoration:none; width:6em; text-align:center;}
#menu li a:visited { }
#menu li a:hover { background-color:#327cc8 }
#menu li a:active { background-color:#FFF;color:#000; }
/* MENU END*/

#outcontent {clear:both; background-color:#FFFFFF; }
.content {background-color:#FFF; padding:10px; height:300px; margin:0px; }

#loading { clear:both; background:url(wait.gif) center top no-repeat; text-align:center;padding:33px 0px 0px 0px; font-size:12px;display:none; font-family:Verdana, Arial, Helvetica, sans-serif; }
&lt;/style&gt;
</pre>
<p>The CSS is pretty straight forward.</p>
<ul>
<li><span class="code">#page</span> will be assigned to a div, which will hold our menu and other divs
<li><span class="code">#menu</span> is the CSS to display our menu tabs.</li>
<li><span class="code">#loading</span> is the CSS to display the AJAX loading image.</li>
<li><span class="code">#outcontent</span> is the container to contain <span class="code">.content</span></li>
</ul>
<p>Put the above code inside the <span class="code">HEAD</span> tag of <span class="code">interface.html</span>. So <span class="code">interface.html</span> will look something like the following.</p>
<pre class="brush: html">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;interface.html&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
body { margin:0 auto 0 auto; color:#000; font-family:Georgia, &quot;Times New Roman&quot;, Times, serif; font-size:16px; background-color:#666666; }

.page { margin:100px auto 0 auto; width:750px;}

#menu  { list-style:none; margin:0px; padding:0px;}

#menu li { list-style:none; display:inline; }
li.active a { background-color:#FFF;color:#000; }

#menu li a,#menu li a:link { float:left; background-color:#3c3c3c; margin-right:5px; padding:7px; color:#FFFFFF; text-decoration:none; width:6em; text-align:center;}
#menu li a:visited { }
#menu li a:hover { background-color:#327cc8 }
#menu li a:active { background-color:#FFF;color:#000; }

.content {
background-color:#FFF; background:url(ajaxinterface.jpg) bottom right no-repeat; padding:10px; height:300px; margin:0px; }

#loading { clear:both; background:url(wait.gif) center top no-repeat; text-align:center;padding:33px 0px 0px 0px; font-size:12px;display:none; font-family:Verdana, Arial, Helvetica, sans-serif; }

#outcontent {clear:both; background-color:#FFFFFF; }

&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The above is the HTML page <span class="code">interface.html</span> with the CSS defined in it.</p>
<h4><a name="html"></a>Step 2 &#8211; The HTML</h4>
<p>Ok! Since now we have coded the CSS, lets create the HTML divs inside <span class="code">interface.html</span>.</p>
<ol>
<li>Inside the <span class="code">BODY</span> tag lets create a div which will contain the menu and the subsequent divs.</li>
<pre class="brush: html">
&lt;body&gt;
    &lt;div class=&quot;page&quot;&gt;
    &lt;!-- Menu and other divs go here !--&gt;
    &lt;/div&gt;
&lt;/body&gt;
</pre>
<li>Then we`ll create the menu Tabs.</li>
<pre class="brush: html">
&lt;body&gt;
    &lt;div class=&quot;page&quot;&gt;
    &lt;ul id=&quot;menu&quot;&gt;
    &lt;!-- you can add more tabs as you wish !--&gt;
             &lt;li id=&quot;about&quot;	&gt;&lt;a href=&quot;#&quot; title=&quot;about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
            &lt;li id=&quot;portfolio&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;portfolio&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
            &lt;li id=&quot;contact&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;br style=&quot;clear:both;&quot; /&gt;
    &lt;/div&gt;
&lt;/body&gt;
</pre>
<li>Now we need a container to display our <span class="code">Loading</span> text and our <span class="code">content</span>, so we`ll create 2 divs and lets put these divs inside another div called <span class="code">outcontent</span>. The following is how it`ll look.</li>
<pre class="brush: html">
&lt;body&gt;
    &lt;div class=&quot;page&quot;&gt;
        &lt;div&gt;
            &lt;ul id=&quot;menu&quot;&gt;
            &lt;!-- you can add more tabs as you wish !--&gt;
                         &lt;li id=&quot;about&quot;	&gt;&lt;a href=&quot;#&quot; title=&quot;about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
                        &lt;li id=&quot;portfolio&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;portfolio&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
                        &lt;li id=&quot;contact&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;br style=&quot;clear:both;&quot; /&gt;
        &lt;/div&gt;
        &lt;!-- #outcontent - Overall div containing Loading div &amp;amp;amp; content div !--&gt;
        &lt;div id=&quot;outcontent&quot;&gt;
           	 &lt;div id=&quot;loading&quot;&gt;LOADING&lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;!-- #outcontent end !--&gt;
    &lt;/div&gt;
&lt;/body&gt;
</pre>
</ol>
<p><span class="code">interface.html</span></p>
<pre class="brush: html">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;interface.html&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
body { margin:0 auto 0 auto; color:#000; font-family:Georgia, &quot;Times New Roman&quot;, Times, serif; font-size:16px; background-color:#666666; }

.page { margin:100px auto 0 auto; width:750px;}

#menu  { list-style:none; margin:0px; padding:0px;}

#menu li { list-style:none; display:inline; }
li.active a { background-color:#FFF;color:#000; }

#menu li a,#menu li a:link { float:left; background-color:#3c3c3c; margin-right:5px; padding:7px; color:#FFFFFF; text-decoration:none; width:6em; text-align:center;}
#menu li a:visited { }
#menu li a:hover { background-color:#327cc8 }
#menu li a:active { background-color:#FFF;color:#000; }

.content {
background-color:#FFF; padding:10px; height:300px; margin:0px; }

#loading { clear:both; background:url(wait.gif) center top no-repeat; text-align:center;padding:33px 0px 0px 0px; font-size:12px;display:none; font-family:Verdana, Arial, Helvetica, sans-serif; }

#outcontent {clear:both; background-color:#FFFFFF; }

&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;page&quot;&gt;
&lt;div&gt;
&lt;ul id=&quot;menu&quot;&gt;
             &lt;li id=&quot;about&quot;	&gt;&lt;a href=&quot;#&quot; title=&quot;about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
            &lt;li id=&quot;portfolio&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;portfolio&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
            &lt;li id=&quot;contact&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br style=&quot;clear:both;&quot; /&gt;
&lt;/div&gt;
&lt;div id=&quot;outcontent&quot;&gt;
&lt;div id=&quot;loading&quot;&gt;LOADING&lt;/div&gt;
&lt;div class=&quot;content&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The page should look something like the following</p>
<p style="text-align: center;"><a href="http://www.visionmasterdesigns.com/blog/wp-content/uploads/2008/07/t2.jpg" rel="lightbox[pics218]" title="empty Interface.html"><img src="http://www.visionmasterdesigns.com/blog/wp-content/uploads/2008/07/t2.thumbnail.jpg" alt="empty Interface.html" width="425" height="305" class="attachment wp-att-229 centered" /></a></p>
<h4><a name="javascript"></a>Step 3 &#8211; Add the Javascript Magic !</h4>
<p>This page would do for static pages, but we are making an AJAX powered page ! Its time to add the magic.<br />
First if you have read the <a href="http://www.visionmasterdesigns.com/blog/2008/07/exploring-javascript-frameworks-jquery-126/">Exploring Javascript Frameworks : jQuery 1.2.6</a> post, it should not be a problem.</p>
<ol>
<li>First lets link to the jquery library</li>
<pre class="brush: javascript">
&lt;script src=&quot;jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
</pre>
<li>Next lets open the script tag again and add the following code. The following code is pretty explainatory. I have added a lot of comments to show what each and every line does.</li>
<pre class="brush: javascript">
&lt;script&gt;
  // When the document loads do everything inside here ...
     $(document).ready(function(){
	 $(&#039;.content&#039;).load(&#039;boo.php&#039;);	//by default initally load text from boo.php
         $(&#039;#menu a&#039;).click(function() { //start function when any link is clicked
		 				$(&quot;.content&quot;).slideUp(&quot;slow&quot;);
						 var content_show = $(this).attr(&quot;title&quot;); //retrieve title of link so we can compare with php file
							$.ajax({
							method: &quot;get&quot;,url: &quot;boo.php&quot;,data: &quot;page=&quot;+content_show,
							beforeSend: function(){$(&quot;#loading&quot;).show(&quot;fast&quot;);}, //show loading just when link is clicked
							complete: function(){ $(&quot;#loading&quot;).hide(&quot;fast&quot;);}, //stop showing loading when the process is complete
							success: function(html){ //so, if data is retrieved, store it in html
							$(&quot;.content&quot;).show(&quot;slow&quot;); //animation
							$(&quot;.content&quot;).html(html); //show the html inside .content div
					 }
				 }); //close $.ajax(
         }); //close click(
	 }); //close $(
&lt;/script&gt;
</pre>
</ol>
<p>Voila ! thats it.</p>
<h2><a name="interface"></a>Our Final interface.html page</h2>
<pre class="brush: javascript">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;interface.html&lt;/title&gt;
&lt;script src=&quot;jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
 &lt;script&gt;
  // When the document loads do everything inside here ...
     $(document).ready(function(){
	 $(&#039;.content&#039;).load(&#039;boo.php&#039;);	//by default initally load text from boo.php
         $(&#039;#menu a&#039;).click(function() { //start function when any link is clicked
		 				$(&quot;.content&quot;).slideUp(&quot;slow&quot;);
						 var content_show = $(this).attr(&quot;title&quot;); //retrieve title of link so we can compare with php file
							$.ajax({
							method: &quot;get&quot;,url: &quot;boo.php&quot;,data: &quot;page=&quot;+content_show,
							beforeSend: function(){$(&quot;#loading&quot;).show(&quot;fast&quot;);}, //show loading just when link is clicked
							complete: function(){ $(&quot;#loading&quot;).hide(&quot;fast&quot;);}, //stop showing loading when the process is complete
							success: function(html){ //so, if data is retrieved, store it in html
							$(&quot;.content&quot;).show(&quot;slow&quot;); //animation
							$(&quot;.content&quot;).html(html); //show the html inside .content div
					 }
				 }); //close $.ajax(
         }); //close click(
	 }); //close $(
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
body { margin:0 auto 0 auto; color:#000; font-family:Georgia, &quot;Times New Roman&quot;, Times, serif; font-size:16px; background-color:#666666; }

.page { margin:100px auto 0 auto; width:750px;}

#menu  { list-style:none; margin:0px; padding:0px;}

#menu li { list-style:none; display:inline; }
li.active a { background-color:#FFF;color:#000; }

#menu li a,#menu li a:link { float:left; background-color:#3c3c3c; margin-right:5px; padding:7px; color:#FFFFFF; text-decoration:none; width:6em; text-align:center;}
#menu li a:visited { }
#menu li a:hover { background-color:#327cc8 }
#menu li a:active { background-color:#FFF;color:#000; }

.content {
background-color:#FFF; padding:10px; height:300px; margin:0px; }

#loading { clear:both; background:url(wait.gif) center top no-repeat; text-align:center;padding:33px 0px 0px 0px; font-size:12px;display:none; font-family:Verdana, Arial, Helvetica, sans-serif; }

#outcontent {clear:both; background-color:#FFFFFF; }

&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;page&quot;&gt;
&lt;div&gt;
&lt;ul id=&quot;menu&quot;&gt;
             &lt;li id=&quot;about&quot;	&gt;&lt;a href=&quot;#&quot; title=&quot;about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
            &lt;li id=&quot;portfolio&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;portfolio&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
            &lt;li id=&quot;contact&quot;&gt;&lt;a href=&quot;#&quot; title=&quot;contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br style=&quot;clear:both;&quot; /&gt;
&lt;/div&gt;
&lt;div id=&quot;outcontent&quot;&gt;
&lt;div id=&quot;loading&quot;&gt;LOADING&lt;/div&gt;
&lt;div class=&quot;content&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://visionmasterdesigns.com/tutorial-ajax-interface-menu-using-jqueryphp/feed/</wfw:commentRss>
		<slash:comments>89</slash:comments>
		</item>
		<item>
		<title>Exploring Javascript Frameworks : jQuery 1.2.6</title>
		<link>http://visionmasterdesigns.com/exploring-javascript-frameworks-jquery-126/</link>
		<comments>http://visionmasterdesigns.com/exploring-javascript-frameworks-jquery-126/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 14:03:28 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript Frameworks]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://blog.visionmasterdesigns.com/?p=134</guid>
		<description><![CDATA[Always found Javascript boring, its time you start checking out the greener side of Javascript. This Article explores the Javascript Framework : jQuery.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 0 0.6em 0.6em;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fvisionmasterdesigns.com%2Fexploring-javascript-frameworks-jquery-126%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fvisionmasterdesigns.com%2Fexploring-javascript-frameworks-jquery-126%2F&amp;source=rowoot&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Hey guys,</p>
<p>You might be wondering where the hell are the Rails Tuts ! But before that, some of you might have read the <a href="http://www.visionmasterdesigns.com/blog/2008/07/tutorial-introduction-ajax-with-php/">Tutorial : Introduction to AJAX with PHP</a>, if you think coding AJAX is tough, think again ! Recently I have been doing a lot of research about different javascript frameworks which will help me ease AJAX and I came across <strong>JQuery</strong> and <strong>Prototype</strong>. It seems they were very commonly used by lot of people. Not only that, these frameworks, besides just providing AJAX they have a lot of cool features. So I decided to explore them.</p>
<p>This post explores some neat tricks I could do using jQuery ! So read on guys if you wanna learn <img src='http://visionmasterdesigns.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>Index</h2>
<ul>
<li>Introduction</li>
<li><a href="http://www.visionmasterdesigns.com/blog/2008/07/exploring-javascript-frameworks-jquery-126/#jwhat">What is jQuery ?</a></li>
<li><a href="http://www.visionmasterdesigns.com/blog/2008/07/exploring-javascript-frameworks-jquery-126/#download">Download jQuery ?!</a></li>
<li><a href="http://www.visionmasterdesigns.com/blog/2008/07/exploring-javascript-frameworks-jquery-126/#play">Playing with jQuery ?!</a></li>
<li><a href="http://www.visionmasterdesigns.com/blog/2008/07/exploring-javascript-frameworks-jquery-126/#effects">jQuery Effects ! ?</a></li>
</ul>
<p><span id="more-134"></span><br />
<a name="what"></a></p>
<h2>What is jQuery ?</h2>
<p>Ok ! If you have read <a href="http://www.visionmasterdesigns.com/blog/2008/07/tutorial-introduction-ajax-with-php/">Tutorial : Introduction to AJAX with PHP</a>, you will notice what a pain it is to code using javascript. Imagine the same same function to be performed by writing just 5 lines&#8230;this is what jQuery can help us achieve.</p>
<p>It is a set of functions written in javascript, to make our life easier.<br />
For Example</p>
<pre class="brush: javascript">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Base page for content&lt;/title&gt;
&lt;script src=&quot;jquery-1.2.6.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
jQuery(function($) {
$(&quot;#contentArea&quot;).load(&quot;a.html&quot;);
});

//--&gt;
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;contentArea&quot;&gt;&lt;!--loads contents of a.html here--&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The above javascript function will load the contents of a.html to our div with id=contentArea. Imagine doing the same with normal AJAX functions, it would take anything not less than 10 lines of code. Anyways lets see how can use jQuery to minimize our load.</p>
<p><a name="download"></a></p>
<h2>Download jQuery</h2>
<p>First lets download the javascript framework from <a href="http://jquery.com">jquery.com</a>. Since we plan to develop and do a lot testing, download the <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.6.js">jQuery 1.2.6 (97kb, Uncompressed)</a>.</p>
<p>Download the jquery-1.2.6.js file and save it.</p>
<p>Everytime we want to use jQuery, we need to include the above script in our HTML files. You can do so as shown below i.e add <span class="code"><script src="jquery-1.2.6.js" type="text/javascript"></script></span> between the head tags.</p>
<pre class="brush: html">
 &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
 &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
 &lt;head&gt;
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
 &lt;title&gt;Untitled Document&lt;/title&gt;
 &lt;script src=&quot;jquery-1.2.6.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;/body&gt;
 &lt;/html&gt;
 </pre>
<p><a name="play"></a></p>
<h2>Playing with jQuery ?!</h2>
<p>Like I showed you in Page 2. 3 lines of code in javascript using jQuery can do stuff which is far more than 10 lines of code in javascript without jQuery.<br />
 Anyways I am going to show you some neat tricks you can do using jQuery. The basics ofcourse !</p>
<h4>The basic code</h4>
<p>Like I said, you need to include the basic javascript library file if you want to use jQuery features.</p>
<h4>ready function</h4>
<p>The following code shows jQuery equivalent code to the javascript function</p>
<pre class="brush: javascript">
 // normal javascript
 &lt;script type=&quot;text/javascript&quot;&gt;
 window.onload = function(){ alert(&quot;abc&quot;); }
 &lt;/script&gt;

// equivalent in jQuery
 &lt;script src=&quot;jquery-1.2.6.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 $(document).ready(function(){ alert(&quot;abc&quot;); });
 &lt;/script&gt;
 </pre>
<p> <strong>What it does : </strong><br />
 Both the code alert the user with a message box, having msg &#8220;abc&#8221;.</p>
<h4>click function</h4>
<pre class="brush: javascript">
 &lt;script type=&quot;text/javascript&quot;&gt;
 // normal javascript
 function clickme() {
 alert(&quot;abc&quot;);
 }
 &lt;/script&gt;
 &lt;a href=&quot;#&quot; onClick=&quot;clickme();&quot;&gt;Have to specify the function for links you want alert to show&lt;/a&gt;

&lt;script src=&quot;jquery-1.2.6.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 $(document).ready(function() {
 $(&quot;a&quot;).click(function () {	// When any link is clicked
 alert(&quot;abc&quot;); //alert user
 });
 });
 &lt;/script&gt;
 &lt;a href=&quot;#&quot;&gt;All the links will alert&lt;/a&gt;
 </pre>
<p> <strong>What it does : </strong></p>
<p><strong>Normal Javascript -</strong>Displays alert box, if a links is clicked. In normal javascript, we have to write a call to the clickme() function on every link to show alert box.<br />
 <strong>jQuery &#8211; </strong>All the links will show alert box on click since<br />
 <span class="code">$(&#8220;a&#8221;).click(function () {//function });</span> where &#8220;a&#8221; refers to all anchor tags.<br />
 If you want to specify any one particular tag, then<br />
 <span class="code">$(&#8220;a#1&#8243;).click(function () {//function });</span> where alert box will only be displayed when a link with id=1 is clicked.</p>
<h4>add class</h4>
<p><span class="code">$(&#8220;div#foo&#8221;).addClass(&#8220;test&#8221;);</span><br />
 The above code will add the class test to div with id=foo. You can add css styles using this piece of code.</p>
<h4>html code</h4>
<p><span class="code">$(&#8220;div#foo&#8221;).html(&#8220;Hello World&#8221;);</span><br />
 The above code, will update div with id=foo, with Hello World. This is more like<br />
 <span class="code">obj.innerHTML = &#8220;Hello World&#8221;</span> where<br />
 <span class="code">obj = document.getElement(&#8220;foo&#8221;);</span>.</p>
<p>For more information, I suggest you read this <a href="http://docs.jquery.com/Frequently_Asked_Questions">Frequently Asked Questions</a>.</p>
<p>Now lets move to the next page and create some effects !!</p>
<p><a name="effects"></a></p>
<h2>jQuery Effects ! ?</h2>
<p>Yup thats right, jQuery has some neat effects up its sleave.<br />
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script><br />
<script type="text/javascript"><!--
$(document).ready(function() {	
		//fade functions
		$("#fadein").click(function () {	// When any link is clicked		
		$("#fadeeffect").fadeIn("slow");
		});	
		$("#fadeout").click(function () {	// When any link is clicked		
		$("#fadeeffect").fadeOut("slow");
		});
		//slide functions
		$("#slidein").click(function () {	// When any link is clicked		
		$("#slideeffect").slideDown("slow");
		});	
		$("#slideout").click(function () {	// When any link is clicked		
		$("#slideeffect").slideUp("slow");
		});
		//custom animation
		$("#custom").click(function(){
    	$("#customtext").animate({ 
        width: "70%",
        opacity: 0.5,
        marginLeft: "0.6in",
        fontSize: "2em" 
        }, 1500 );
    });
	  });
// --></script></p>
<input id="fadein" name="fadein" type="button" value="Fade In" />
<input id="fadeout" name="fadeout" type="button" value="Fade Out" />
<div id="fadeeffect" style="border:1px solid #1a6780; display:none; margin:10px; background-color:#e3eff3;padding:10px;">FADING&#8230;<br />
Lorem epsom sied van heity rath mapark to ratham. Msgyht raspiem maks vem iey tor sto fo rtem leom. Marks maxi umlion tor pion skim quedrtem lorespiortium.</div>
<input id="slidein" name="slidein" type="button" value="Slide In" />
<input id="slideout" name="slideout" type="button" value="Slide Out" />
<div id="slideeffect" style="border:1px solid #1a6780; display:none; margin:10px; background-color:#e3eff3;padding:10px;">SLIDING&#8230;<br />
Lorem epsom sied van heity rath mapark to ratham. Msgyht raspiem maks vem iey tor sto fo rtem leom. Marks maxi umlion tor pion skim quedrtem lorespiortium.</div>
<p>The code for the above effects..</p>
<pre class="brush: javascript">
&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
//fade functions
$(&quot;#fadein&quot;).click(function () {	// When any link is clicked
$(&quot;#fadeeffect&quot;).fadeIn(&quot;slow&quot;); //fade in effect
});
$(&quot;#fadeout&quot;).click(function () {	// When any link is clicked
$(&quot;#fadeeffect&quot;).fadeOut(&quot;slow&quot;); //fade out effect
});
//slide functions
$(&quot;#slidein&quot;).click(function () {	// When any link is clicked
$(&quot;#slideeffect&quot;).slideDown(&quot;slow&quot;); //slide in
});
$(&quot;#slideout&quot;).click(function () {	// When any link is clicked
$(&quot;#slideeffect&quot;).slideUp(&quot;slow&quot;); //slide out
});
});
&lt;/script&gt;
&lt;input type=&quot;button&quot; id=&quot;fadein&quot; name=&quot;fadein&quot; value=&quot;Fade In&quot; /&gt;
&lt;input type=&quot;button&quot; id=&quot;fadeout&quot; name=&quot;fadeout&quot; value=&quot;Fade Out&quot; /&gt;
&lt;div id=&quot;fadeeffect&quot; style=&quot;border:1px solid #1a6780; display:none; margin:10px;padding:10px; background-color:#e3eff3;&quot;&gt;
FADING...
Lorem epsom sied van heity rath mapark to ratham. Msgyht raspiem maks vem iey tor sto fo rtem leom. Marks maxi umlion tor pion skim quedrtem lorespiortium.
&lt;/div&gt;
&lt;input type=&quot;button&quot; id=&quot;slidein&quot; name=&quot;slidein&quot; value=&quot;Slide In&quot;  /&gt;
&lt;input type=&quot;button&quot; id=&quot;slideout&quot; name=&quot;slideout&quot; value=&quot;Slide Out&quot;  /&gt;
&lt;div id=&quot;slideeffect&quot; style=&quot;border:1px solid #1a6780; display:none; margin:10px; padding:10px; background-color:#e3eff3;&quot;&gt;
SLIDING...
Lorem epsom sied van heity rath mapark to ratham. Msgyht raspiem maks vem iey tor sto fo rtem leom. Marks maxi umlion tor pion skim quedrtem lorespiortium.
&lt;/div&gt;
</pre>
<p>Pretty cool huh ! just 3 lines of code and viola !<br />
jQuery also gives the ability to create a custom animation.</p>
<input id="custom" name="custom" type="button" value="Animate" />
<div id="customtext" style="border: 1px solid #1a6780; margin: 10px; padding: 5px; background-color: #e3eff3; width: 100px;">Animate</div>
<p>The code for the above is</p>
<pre class="brush: javascript">
&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
//custom animation
$(&quot;#custom&quot;).click(function(){
$(&quot;#customtext&quot;).animate({
width: &quot;70%&quot;,
opacity: 0.5,
marginLeft: &quot;0.6in&quot;,
fontSize: &quot;2em&quot;,
}, 1500 );
});
&lt;/script&gt;
&lt;input type=&quot;button&quot; id=&quot;custom&quot; name=&quot;custom&quot; value=&quot;Animate&quot;  /&gt;
&lt;div id=&quot;customtext&quot; style=&quot;border:1px solid #1a6780; margin:10px; padding:5px; background-color:#e3eff3; width:100px;&quot;&gt;
Animate ME !
&lt;/div&gt;
</pre>
<p>You can read more documentation about these effects <a href="http://docs.jquery.com/Effects">http://docs.jquery.com/Effects</a>.</p>
<p>Well I have covered most of the usual functions people use with jQuery. Use your imagination to create stunning webpages. you can visit <a href="http://www.visionmasterdesigns.com">http://www.visionmasterdesigns.com</a> since it is jQuery powered.</p>
<p>But hold on guys ! Be sure to check out the next part where we will be exploring another famous javascript framework &#8220;<a href="http://www.prototypejs.org">Prototype</a>&#8220;.</p>
<p>Cya</p>
<div class="donate"><strong>Found this tutorial really useful, you can click here to donate.</strong></p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_donations" />
<input name="business" type="hidden" value="rowoot@gmail.com" />
<input name="item_name" type="hidden" value="MICHEAL BENEDICT ARUL" />
<input name="no_shipping" type="hidden" value="0" />
<input name="no_note" type="hidden" value="1" />
<input name="currency_code" type="hidden" value="USD" />
<input name="tax" type="hidden" value="0" />
<input name="lc" type="hidden" value="IN" />
<input name="bn" type="hidden" value="PP-DonationsBF" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
</div>
]]></content:encoded>
			<wfw:commentRss>http://visionmasterdesigns.com/exploring-javascript-frameworks-jquery-126/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
