<?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>Banhawi &#187; Tutorial</title>
	<atom:link href="http://banhawi.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://banhawi.com</link>
	<description>Web Design and Development News and Tutorials</description>
	<lastBuildDate>Thu, 29 Jul 2010 00:50:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Support WP3.0 Custom Menus</title>
		<link>http://banhawi.com/2010/07/support-wp3-0-custom-menus/</link>
		<comments>http://banhawi.com/2010/07/support-wp3-0-custom-menus/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 00:42:24 +0000</pubDate>
		<dc:creator>Banhawi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom menus]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[wordpress 3]]></category>

		<guid isPermaLink="false">http://banhawi.com/?p=193</guid>
		<description><![CDATA[
The new wordpress 3.0 custom menus feature is one of the best newly added features to wordpress that gives you more control on your menus every where on your web site .
Wordpress new custom menus works in simple two steps .

First : Register the menu
register your menus in your theme&#8217;s functions.php file
register_nav_menus( array( $location =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-196 alignright" title="wordpress 3.0 custom menus" src="http://banhawi.com/wp-content/uploads/2010/07/custom-menu-150x150.png" alt="wordpress 3.0 custom menus" width="150" height="150" /><br />
The new wordpress 3.0 custom menus feature is one of the best newly added features to wordpress that gives you more control on your menus every where on your web site .<br />
Wordpress new custom menus works in simple two steps .</p>
<p><span id="more-193"></span></p>
<h3>First : Register the menu</h3>
<p>register your menus in your theme&#8217;s functions.php file</p>
<pre class="brush: php;">register_nav_menus( array( $location =&gt; $description ) ); </pre>
<p><strong>Real Example</strong></p>
<pre class="brush: php;">
if ( function_exists( 'register_nav_menu' ) ) {
register_nav_menu( 'topnav', 'Top Navigation' );
}
</pre>
<p>you can register as many custom menus as you want .</p>
<h3>Second : Place the menu</h3>
<p>Now it&#8217;s time to place your menus where you want it to be showed on your theme</p>
<pre class="brush: php;">
&lt;?php wp_nav_menu(); ?&gt;
</pre>
<p>That&#8217;s it , now just play with your wordpress menu designer and have fun <img src='http://banhawi.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> <br/><br />
<strong>Functions Used : </strong><a href="http://codex.wordpress.org/Function_Reference/register_nav_menu" target="_blank">register_nav_menus</a> &amp;  <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank">wp_nav_menu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://banhawi.com/2010/07/support-wp3-0-custom-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Your Own &#8220;kwicks&#8221; jQuery Effect</title>
		<link>http://banhawi.com/2009/06/create-your-own-kwicks-jquery-effect/</link>
		<comments>http://banhawi.com/2009/06/create-your-own-kwicks-jquery-effect/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 12:18:51 +0000</pubDate>
		<dc:creator>Banhawi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Navigation Effect]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://banhawi.com/?p=27</guid>
		<description><![CDATA[Today&#8217;s tutorial and my first tutorial here will be about jQuery , i&#8217;m going to explain how to create your own popular &#8220;kwicks&#8221; effect . For those who don&#8217;t know Kwicks jQuery Plugin here&#8217;s a link to it , kwicks plugin was developed by Jeremy Martin .

Demo &#8211; Source


Step One
Let&#8217;s start writing our markup .


&#60;html&#62;
	&#60;head&#62;
		&#60;title&#62;JS [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s tutorial and my first tutorial here will be about jQuery , i&#8217;m going to explain how to create your own popular &#8220;kwicks&#8221; effect . For those who don&#8217;t know Kwicks jQuery Plugin here&#8217;s a <a href="http://www.jeremymartin.name/projects.php?project=kwicks">link</a> to it , kwicks plugin was developed by Jeremy Martin .</p>
<div class="demo">
<a href="http://banhawi.com/demos/jquery/kwicks-clone/Example.html">Demo</a> &#8211; <a href="http://banhawi.com/wp-content/uploads/2009/06/kwicks-clone.zip">Source</a>
</div>
<p><span id="more-27"></span></p>
<h3>Step One</h3>
<p>Let&#8217;s start writing our markup .</p>
<pre class="brush: html;">

&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;JS Effect&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/products.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/history.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/news.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/urideas.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>As you see in the code above it&#8217;s just a normal html page containing a ul menu with four &#8220;li&#8221; members , each li containing linked image . Pretty simple is not it ?</p>
<h3>Step Two</h3>
<p>Let&#8217;s write our CSS</p>
<pre class="brush: css;">
			ul li {
				list-style-type: none;
				width: 125px;
				height: 100px;
				margin-right: 10px;
				float: left;
				overflow: hidden;
			}
			a img {
				border: 0;
			}
</pre>
<p>The code above is pretty simple we just styled all &#8220;li&#8221; members and removed the border from linked images .</p>
<h3>Step Three</h3>
<p>Import the jQuery library , simply add this line in within the &lt;head&gt; &lt;/head&gt; tags in your HTML .</p>
<pre class="brush: html;">
&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
</pre>
<h3>Step Four</h3>
<p>This tells the browser to run the functions within the { } when the html document is ready .</p>
<pre class="brush: javascript;">
$(document).ready(function(){

});
</pre>
<h3>Step Five</h3>
<pre class="brush: javascript;">
$(document).ready(function(){
	$(&quot;li&quot;).mouseover(function(){
		$(&quot;li&quot;).animate({ width: &quot;100px&quot;}, 500 );
		$(this).animate({ width: &quot;200px&quot;}, 500 );
	});
});
</pre>
<p>In the code above we used the mouseover event , which means the function that follows $(&#8221;li&#8221;).mouseover will be executed only when you hover on one of the &#8220;li&#8221; members .</p>
<p>Then we use the animate effect   $(&#8221;li&#8221;).animate({ width: &#8220;100px&#8221;}, 500 ); this means animate all &#8220;li&#8221; members using the following css properties which is width:&#8221;100px&#8221; .</p>
<p>After adding your new css  properties you define the speed of the animation which is 500 here , you can add your own speed or you can use slow , normal , fast instead of numbers.</p>
<p>This will animate the &#8220;li&#8221; members from width 125px predefined in the css to the new 100px width with speed of 500 milliseconds .</p>
<p>$(this).animate({ width: &#8220;200px&#8221;}, 500 ); &#8211; $(this) means animate the hovered &#8220;li&#8221; member to width 200px with the speed of 500 milliseconds .</p>
<p>Finally we close the mouseover event }); .</p>
<p>If you tested the code we have done so far you&#8217;ll notice that the &#8220;li&#8221; members first animate to the width of 100px then the hovered one animates to the width of 200px , and this is not good as it may cause a problem when changing the width of the &#8220;li&#8221; members to 100px the cursor may hover on another &#8220;li&#8221; member which will cause animating another &#8220;li&#8221; member , we can fix this by adding different css classes to the &#8220;li&#8221; members when hovered and when not .</p>
<p>so Let&#8217;s Edit the html .</p>
<h3>Step Six</h3>
<pre class="brush: html;">
&lt;ul&gt;
	&lt;li class=&quot;inactive&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/products.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;inactive&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/history.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;inactive&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/news.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;inactive&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;images/urideas.jpg&quot; alt=&quot;&quot;/&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Here we have added class=&#8221;inactive&#8221; to all &#8220;li&#8221; members .</p>
<h3>Step Seven</h3>
<p>Now we have defined all un hovered &#8220;li&#8221; members with inactive class , jQuery give us the ability to add css classes using the Attribute addClass and removing css classes using the Attribute removeClass , we will use these Attributes in the next code .</p>
<pre class="brush: javascript;">
$(document).ready(function(){
	$(&quot;li&quot;).mouseover(function(){
		$(this).removeClass(&quot;inactive&quot;);
		$(this).addClass(&quot;active&quot;);
		$(&quot;li.active&quot;).animate({ width: &quot;200px&quot;}, 500 );
		$(&quot;li.inactive&quot;).animate({ width: &quot;100px&quot;}, 500 );
	});
});
</pre>
<p>First and second line we explained before .</p>
<p>Third line $(this).removeClass(&#8221;inactive&#8221;); mean remove &#8220;inactive&#8221; css class from hovered &#8220;li&#8221; member .</p>
<p>Fourth line $(this).addClass(&#8221;active&#8221;); mean add &#8220;active&#8221; css class to hovered &#8220;li&#8221; member .</p>
<p>Fifth line $(&#8221;li.active&#8221;).animate({ width: &#8220;200px&#8221;}, 500 ); animates the active hovered &#8220;li&#8221; member to the new 200px width with speed of 500 millisecond.</p>
<p>Sixth line $(&#8221;li.inactive&#8221;).animate({ width: &#8220;100px&#8221;}, 500 ); animates the inactive unhovered &#8220;li&#8221; member to the new 100px width with speed of 500 millisecond .</p>
<p>Then we close our events .</p>
<h3>Step Eight</h3>
<p>Approximately we are done , but there&#8217;s a problem which is when we hover on one of the &#8220;li&#8221; it animates to the new width of 200px and the other unhovered &#8220;li&#8221; members to the new 100px width and this is not good because when take the cursor away of the &#8220;li&#8221; member , all the &#8220;li&#8221; members stay with new widths , we want them animate back to the original widths when we take the cursor away of the &#8220;li&#8221; members , so we have to write the next code  after  $(&#8221;li&#8221;).mouseover(function(){ &#8230; });</p>
<pre class="brush: javascript;">
$(&quot;li&quot;).mouseout(function(){
	$(this).removeClass(&quot;active&quot;);
	$(this).addClass(&quot;inactive&quot;);
	$(&quot;li&quot;).animate({ width: &quot;125px&quot;}, 500 );
});
</pre>
<p>In the above code we used a new event called mouseout which mean do the involved function when taking the cursor away of &#8220;li&#8221; member .</p>
<p>Second line $(this).removeClass(&#8221;active&#8221;); means remove the &#8220;active&#8221; css class from the was hovered &#8220;li&#8221; member .</p>
<p>Third line $(this).addClass(&#8221;inactive&#8221;); means add the &#8220;inactive&#8221; css class to the was hovered &#8220;li&#8221; member .</p>
<p>Fourth line $(&#8221;li&#8221;).animate({ width: &#8220;125px&#8221;}, 500 ); animates all the &#8220;li&#8221; members to the original width of 125px with the speed of 500 milliseconds .</p>
<p>After that we close the mouseout event .</p>
<h3>Extra Step</h3>
<p>Be creative , we&#8217;ve created so far  just a width expanding ul menu , you can add height to the animate effect function and your ul menu will expand in both dimensions .<br />
Here&#8217;s will be the new jquery code </p>
<pre class="brush: javascript;">
  		$(document).ready(function(){
    		$(&quot;li&quot;).mouseover(function(){
   				$(this).removeClass(&quot;inactive&quot;);
   				$(this).addClass(&quot;active&quot;);
        		$(&quot;li.active&quot;).animate({ width: &quot;200px&quot;,height: &quot;120px&quot;}, 500 );
      			$(&quot;li.inactive&quot;).animate({ width: &quot;100px&quot;,height: &quot;100px&quot;}, 500 );
      		});
      		$(&quot;li&quot;).mouseout(function(){
    			$(this).removeClass(&quot;active&quot;);
   				$(this).addClass(&quot;inactive&quot;);
      			$(&quot;li&quot;).animate({ width: &quot;125px&quot;,height: &quot;100px&quot;}, 500 );
    		});
  		});
</pre>
<div class="demo">
<a href="http://banhawi.com/demos/jquery/kwicks-clone/yet-another-example.html">Yet Another Example</a>
</div>
<h3>Read More</h3>
<ul>
<li>http://docs.jquery.com/Events/</li>
<li>http://docs.jquery.com/Attributes/</li>
<li>http://docs.jquery.com/API/1.3/Effects</li>
]]></content:encoded>
			<wfw:commentRss>http://banhawi.com/2009/06/create-your-own-kwicks-jquery-effect/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
