<?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>AddyOsmani.com &#124; Where Web Businesses Grow</title>
	<atom:link href="http://addyosmani.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://addyosmani.com/blog</link>
	<description>This is the home of Addy Osmani (Web Developer and Entrepreneur). Here you can find some great tips and tutorials on everything to do with web development and even a few cool code samples!</description>
	<lastBuildDate>Mon, 08 Mar 2010 22:57:36 +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>50 jQuery Snippets That Will Help You Become A Better JavaScript Developer</title>
		<link>http://addyosmani.com/blog/50-jquery-snippets-for-developers/</link>
		<comments>http://addyosmani.com/blog/50-jquery-snippets-for-developers/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:28:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[custom functions]]></category>
		<category><![CDATA[custom methods]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery 1.3.2]]></category>
		<category><![CDATA[jquery 1.4.2]]></category>
		<category><![CDATA[jquery binding]]></category>
		<category><![CDATA[jquery custom functions]]></category>
		<category><![CDATA[jquery developers]]></category>
		<category><![CDATA[jquery functions]]></category>
		<category><![CDATA[jquery has]]></category>
		<category><![CDATA[jquery images]]></category>
		<category><![CDATA[jquery nesting]]></category>
		<category><![CDATA[jquery samples]]></category>
		<category><![CDATA[jquery snippet collection]]></category>
		<category><![CDATA[jquery xml]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[sample functions]]></category>
		<category><![CDATA[snippet library]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/?p=422</guid>
		<description><![CDATA[
&#160;
&#160;
In today&#8217;s post I&#8217;m going to show you guys 50 jQuery Snippets that can help you with your JavaScript projects. Some of these snippets are going to be things that have just been supported with jQuery 1.4.2 whilst others are really useful functions or methods that can help you do things better or quicker. I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://addyosmani.com/blog/50-jquery-snippets-for-developers/"><img width="530" height="342" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/03/snippets.jpg"  class="alignnone size-full wp-image-431" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>In today&#8217;s post I&#8217;m going to show you guys 50 jQuery Snippets that can help you with your JavaScript projects. Some of these snippets are going to be things that have just been supported with jQuery 1.4.2 whilst others are really useful functions or methods that can help you do things better or quicker. I&#8217;ve tried to bare in mind optimal performance with these snippets so if there&#8217;s anything you see that you think could be done better, please feel free to post your version in the comments!. I hope you find the post useful.</p>
<p><span id="more-422"></span></p>
<p>&nbsp;</p>
<p>
<style type="text/css">
  #tiplist { list-style-type: decimal; }</p>
</style>
<div>&nbsp;</div>
<ul id="tiplist">
<li>
<h2>How to Create A Nested Filter:</h2>
<pre name="code" class="javascript">
 //a filter allows you to reduce the set of matched elements
 //to those that match a given selector. In this case the query
 //removes anything which doesn't (:not) have (:has) a child with
 //class &quot;selected&quot; (.selected)

 .filter(&quot;:not(:has(.selected))&quot;)
</pre>
</li>
<li>
<h2>How to Reuse Your Element Searches</h2>
<pre name="code" class="html">
var allItems = $(&quot;div.item&quot;);
var keepList = $(&quot;div#container1 div.item&quot;);

//Now you can keep working with those jQuery objects. For example,
//trim down the &quot;keep list&quot; based on checkboxes whose names
//correspond to
<div>class names:

$(formToLookAt + &quot; input:checked&quot;).each(function() {     keepList = keepList.filter(&quot;.&quot; + $(this).attr(&quot;name&quot;)); });</div>
</pre>
</li>
<li>
<h2>How To Check If An Element contains a certain class or element with <i>has()</i>:</h2>
<pre name="code" class="javascript">

 //jQuery 1.4.* includes support for the has method. This method will find
 //if a an element contains a certain other element class or whatever it is
 //you are looking for and do anything you want to them.

 $(&quot;input&quot;).has(&quot;.email&quot;).addClass(&quot;email_icon&quot;);  
</pre>
</li>
<li>
<h2>How to Switch StyleSheets With jQuery:</h2>
<pre name="code" class="javascript">
	//Look for the media-type you wish to switch then set the href to your new style sheet
	$('link[media='screen']').attr('href', 'Alternative.css');</pre>
</li>
<li>
<h2>How to Limit the Scope of Selection (For Optimization):</h2>
<pre name="code" class="javascript">

		//Where possible, pre-fix your class names with a tag name
		//so that jQuery doesn't have to spend more time searching
		//for the element you're after. Also remember that anything
		//you can do to be more specific about where the element is
		//on your page will cut down on execution/search times

		var in_stock = $('#shopping_cart_items input.is_in_stock');
</pre>
<pre name="code" class="html">
<ul id="shopping_cart_items">
<li>
<input type="radio" value="Item-X" name="item" class="is_in_stock" /> Item X</li>
<li>
<input type="radio" value="Item-Y" name="item" class="3-5_days" /> Item Y</li>
<li>
<input type="radio" value="Item-Z" name="item" class="unknown" /> Item Z</li>
</ul>
</pre>
</li>
<li>
<h2>How to Correctly Use ToggleClass:</h2>
<pre name="code" class="javascript">

	 //Toggle class allows you to add or remove a class
	 //from an element depending on the presence of that
	 //class. Where some developers would use:

	 a.hasClass('blueButton') ? a.removeClass('blueButton') : a.addClass('blueButton');

	 //toggleClass allows you to easily do this using

	 a.toggleClass('blueButton');
</pre>
</li>
<li>
<h2>How to set an IE Specific Function:</h2>
<pre name="code" class="javascript">

	if ($.browser.msie) { // Internet Explorer is a sadist. }
</pre>
</li>
<li>
<h2>How to Replace an element with jQuery:</h2>
<pre name="code" class="javascript">
$('#thatdiv').replaceWith('fnuh');</pre>
</li>
<li>
<h2>How to Verify if an element is empty:</h2>
<pre name="code" class="javascript">
if ($('#keks').html()) { //Nothing found ;} </pre>
</li>
<li>
<h2>How to find out the index of an element in an unordered set</h2>
<pre name="code" class="javascript">
$(&quot;ul &gt; li&quot;).click(function () {
    var index = $(this).prevAll().length;
});</pre>
</li>
<li>
<h2>How to Bind a function to an event:</h2>
<pre name="code" class="javascript">
$('#foo').bind('click', function() {
  alert('User clicked on &quot;foo.&quot;');
});</pre>
</li>
<li>
<h2>How to Append or add HTML to an element:</h2>
<pre name="code" class="javascript">
$('#lal').append('sometext');</pre>
</li>
<li>
<h2>How to use an object literal to define properties when creating an element</h2>
<pre name="code" class="javascript">
	var e = $(&quot;&quot;, { href: &quot;#&quot;, class: &quot;a-class another-class&quot;, title: &quot;...&quot; });
	</pre>
</li>
<li>
<h2>How to Filter using multiple-attributes</h2>
<pre name="code" class="javascript">

	//This precision-based approached can be useful when you use
	//lots of similar input elements which have different types
	var elements = $('#someid input[type=sometype][value=somevalue]').get();
	</pre>
</li>
<li>
<h2>How to Preload images with jQuery:</h2>
<pre name="code" class="javascript">

	jQuery.preloadImages = function() { for(var i = 0; i').attr('src', arguments[i]); } };

	// Usage $.preloadImages('image1.gif', '/path/to/image2.png', 'some/image3.jpg');
	</pre>
</li>
<li>
<h2>How to set an event handler for any element that matches a selector:</h2>
<pre name="code" class="javascript">
$('button.someClass').live('click', someFunction);

	//Note that in jQuery 1.4.2, the delegate and undelegate options have been
	//introduced to replace live as they offer better support for context

    //For example, in terms of a table where before you would use..

	// .live()
	$(&quot;table&quot;).each(function(){
	  $(&quot;td&quot;, this).live(&quot;hover&quot;, function(){
		$(this).toggleClass(&quot;hover&quot;);
	  });
	});

	//Now use..

	$(&quot;table&quot;).delegate(&quot;td&quot;, &quot;hover&quot;, function(){
  $(this).toggleClass(&quot;hover&quot;);
});
</pre>
</li>
<li>
<h2>How to find an option element that&#8217;s been selected:</h2>
<pre name="code" class="javascript">
	$('#someElement').find('option:selected');
	</pre>
</li>
<li>
<h2>How to hide an element that contains text of a certain value:</h2>
<pre name="code" class="javascript">
$(&quot;p.value:contains('thetextvalue')&quot;).hide();</pre>
</li>
<li>
<h2>How To AutoScroll to a section of your page:</h2>
<pre name="code" class="javascript">
jQuery.fn.autoscroll = function(selector) {
  $('html,body').animate(
    {scrollTop: $(selector).offset().top},
    500
  );
}

//Then to scroll to the class/area you wish to get to like this:
$('.area_name').autoscroll();
</pre>
</li>
<li>
<h2>How To Detect Any Browser:</h2>
<pre name="code" class="javascript">
	Detect Safari (if( $.browser.safari)),
	Detect IE6 and over (if ($.browser.msie &amp;&amp; $.browser.version &gt; 6 )),
	Detect IE6 and below (if ($.browser.msie &amp;&amp; $.browser.version &lt;= 6 )),
	Detect FireFox 2 and above (if ($.browser.mozilla &amp;&amp; $.browser.version &gt;= '1.8' ))</pre>
</li>
<li>
<h2>How To Replace a word in a string:</h2>
<pre name="code" class="javascript">
var el = $('#id');
	el.html(el.html().replace(/word/ig, ''));</pre>
</li>
<li>
<h2>How To Disable right-click contextual menu :</h2>
<pre name="code" class="javascript">
$(document).bind('contextmenu',function(e){ return false; });</pre>
</li>
<li>
<h2>How to define a Custom Selector</h2>
<pre name="code" class="javascript">
	$.expr[':'].mycustomselector = function(element, index, meta, stack){
    // element- is a DOM element
    // index - the current loop index in stack
    // meta - meta data about your selector
    // stack - stack of all elements to loop

    // Return true to include current element
    // Return false to explude current element
};

// Custom Selector usage:
$('.someClasses:test').doSomething();
</pre>
</li>
<li>
<h2>How to check if an element exists</h2>
<pre name="code" class="javascript">
if ($('#someDiv').length) {//hooray!!! it exists...}</pre>
</li>
<li>
<h2>How to Detect Both Right &amp; Left Mouse-clicks with jQuery:</h2>
<pre name="code" class="javascript">
$(&quot;#someelement&quot;).live('click', function(e) {
    if( (!$.browser.msie &amp;&amp; e.button == 0) || ($.browser.msie &amp;&amp; e.button == 1) ) {
        alert(&quot;Left Mouse Button Clicked&quot;);
    }
    else if(e.button == 2)
        alert(&quot;Right Mouse Button Clicked&quot;);
});
</pre>
</li>
<li>
<h2>How To Show or Erase a Default Value In An Input Field:</h2>
<pre name="code" class="javascript">
//This snippet will show you how to keep a default value
//in a text input field for when a user hasn't entered in
//a value to replace it

swap_val = [];
$(&quot;.swap&quot;).each(function(i){
    swap_val[i] = $(this).val();
    $(this).focusin(function(){
        if ($(this).val() == swap_val[i]) {
            $(this).val(&quot;&quot;);
        }
    }).focusout(function(){
        if ($.trim($(this).val()) == &quot;&quot;) {
            $(this).val(swap_val[i]);
        }
    });
});
</pre>
<pre name="code" class="html">
<input type="text" value="Enter Username here.." class="swap" />
</pre>
</li>
<li>
<h2>How To Automatically Hide or Close Elements After An Amount Of Time (supports 1.4):</h2>
<pre name="code" class="javascript">

 //Here's how we used to do it in 1.3.2 using setTimeout
    setTimeout(function() {
  $('.mydiv').hide('blind', {}, 500)
}, 5000);

//And here's how you can do it with 1.4 using the delay() feature (this is a lot like sleep)
$(&quot;.mydiv&quot;).delay(5000).hide('blind', {}, 500);
 </pre>
</li>
<li>
<h2>How To Add Dynamically Created Elements to the DOM:</h2>
<pre name="code" class="javascript">
 var newDiv = $('');
	newDiv.attr('id','myNewDiv').appendTo('body'); </pre>
</li>
<li>
<h2>How To Limit The Number Of Characters in a &quot;Text-Area&quot; field:</h2>
<pre name="code" class="javascript">
	jQuery.fn.maxLength = function(max){
	this.each(function(){
		var type = this.tagName.toLowerCase();
		var inputType = this.type? this.type.toLowerCase() : null;
		if(type == &quot;input&quot; &amp;&amp; inputType == &quot;text&quot; || inputType == &quot;password&quot;){
			//Apply the standard maxLength
			this.maxLength = max;
		}
		else if(type == &quot;textarea&quot;){
			this.onkeypress = function(e){
				var ob = e || event;
				var keyCode = ob.keyCode;
				var hasSelection = document.selection? document.selection.createRange().text.length &gt; 0 : this.selectionStart != this.selectionEnd;
				return !(this.value.length &gt;= max &amp;&amp; (keyCode &gt; 50 || keyCode == 32 || keyCode == 0 || keyCode == 13) &amp;&amp; !ob.ctrlKey &amp;&amp; !ob.altKey &amp;&amp; !hasSelection);
			};
			this.onkeyup = function(){
				if(this.value.length &gt; max){
					this.value = this.value.substring(0,max);
				}
			};
		}
	});
};

//Usage:

$('#mytextarea').maxLength(500);
</pre>
</li>
<li>
<h2>How to create a basic test for a function</h2>
<pre name="code" class="javascript">

	//Separate tests into modules.
module(&quot;Module B&quot;);

test(&quot;some other test&quot;, function() {
  //Specify how many assertions are expected to run within a test.
  expect(2);
  //A comparison assertion, equivalent to JUnit's assertEquals.
  equals( true, false, &quot;failing test&quot; );
  equals( true, true, &quot;passing test&quot; );
});
</pre>
</li>
<li>
<h2>How to clone an element in jQuery:</h2>
<pre name="code" class="javascript">
var cloned = $('#somediv').clone(); </pre>
</li>
<li>
<h2>How to test if an element is visible in jQuery:</h2>
<pre name="code" class="javascript">
if($(element).is(':visible') == 'true') { //The element is Visible } </pre>
</li>
<li>
<h2>How to center an element on screen:</h2>
<pre name="code" class="javascript">
jQuery.fn.center = function () {
	this.css('position','absolute');
	this.css('top', ( $(window).height() - this.height() ) / +$(window).scrollTop() + 'px');
	this.css('left', ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + 'px');return this;}
	//Use the above function as: $(element).center(); </pre>
</li>
<li>
<h2>How to put the values of all the elements of a particular name into an array:</h2>
<pre name="code" class="javascript">

	var arrInputValues = new Array();
   $(&quot;input[name='table\\[\\]']&quot;).each(function(){
     arrInputValues.push($(this).val());
});
</pre>
</li>
<li>
<h2>How to Strip HTML From Your Element</h2>
<pre name="code" class="javascript">

	(function($) {
    $.fn.stripHtml = function() {
        var regexp = /&lt;(&quot;[^&quot;]*&quot;|'[^']*'|[^'&quot;&gt;])*&gt;/gi;
        this.each(function() {
            $(this).html(
                $(this).html().replace(regexp,&rdquo;&quot;)
            );
        });
        return $(this);
    }
})(jQuery); 

	//usage:
	$('p').stripHtml();  
</pre>
</li>
<li>
<h2>How to get a parent element using closest:</h2>
<pre name="code" class="javascript">
$('#searchBox').closest('div'); </pre>
</li>
<li>
<h2>How to log jQuery events using Firebug and Firefox:</h2>
<pre name="code" class="javascript">

// Allows chainable logging
// Usage: $('#someDiv').hide().log('div hidden').addClass('someClass');
jQuery.log = jQuery.fn.log = function (msg) {
      if (console){
         console.log(&quot;%s: %o&quot;, msg, this);
      }
      return this;
};
</pre>
</li>
<li>
<h2>How to force links to open in a pop-up window:</h2>
<pre name="code" class="javascript">

	jQuery('a.popup').live('click', function(){
	newwindow=window.open($(this).attr('href'),'','height=200,width=150');
	if (window.focus) {newwindow.focus()}
	return false;
});
</pre>
</li>
<li>
<h2>How to force links to open in a new tab:</h2>
<pre name="code" class="javascript">

jQuery('a.newTab').live('click', function(){
	newwindow=window.open($(this).href);
	jQuery(this).target = &quot;_blank&quot;;
	return false;
});
</pre>
</li>
<li>
<h2>How to select siblings in jQuery using .siblings()</h2>
<pre name="code" class="javascript">

// Rather than doing this
$('#nav li').click(function(){
    $('#nav li').removeClass('active');
    $(this).addClass('active');
});

// Do this instead
$('#nav li').click(function(){
    $(this).addClass('active')
        .siblings().removeClass('active');
});
	</pre>
</li>
<li>
<h2>How to Toggle All the checkboxes on a page:</h2>
<pre name="code" class="javascript">
var tog = false; // or true if they are checked on load
$('a').click(function() {
    $(&quot;input[type=checkbox]&quot;).attr(&quot;checked&quot;,!tog);
    tog = !tog;
});
</pre>
</li>
<li>
<h2>How to filter down a list of elements based on some input text:</h2>
<pre name="code" class="javascript">

	//If the value of the element matches that of the entered text
	//it will be returned
	$('.someClass').filter(function() {
    return $(this).attr('value') == $('input#someId').val() ;
 })
 </pre>
</li>
<li>
<h2>How to get mouse cursor X and Y</h2>
<pre name="code" class="javascript">
$(document).mousemove(function(e){
$(document).ready(function() {
$().mousemove(function(e){
$(&rsquo;#XY&rsquo;).html(&rdquo;X Axis : &rdquo; + e.pageX + &rdquo; | Y Axis &rdquo; + e.pageY);
});
});</pre>
</li>
<li>
<h2>How to make an entire List Element (LI) clickable</h2>
<pre name="code" class="javascript">
$(&quot;ul li&quot;).click(function(){
  window.location=$(this).find(&quot;a&quot;).attr(&quot;href&quot;); return false;
});
</pre>
<pre name="code" class="html">
<ul> 
<li><a href="#">Link 1</a></li>

 
<li><a href="#">Link 2</a></li>

 
<li><a href="#">Link 3</a></li>

	
<li><a href="#">Link 4</a></li>

</ul>
</pre>
</li>
<li>
<h2>How to Parse XML with jQuery (Basic example):</h2>
<pre name="code" class="javascript">
function parseXml(xml) {
	//find every Tutorial and print the author
	$(xml).find(&quot;Tutorial&quot;).each(function()
	{
	$(&quot;#output&quot;).append($(this).attr(&quot;author&quot;) + &quot;&quot;);
	});
}
</pre>
</li>
<li>
<h2>How to Check if an image has been fully loaded:</h2>
<pre name="code" class="javascript">

 $('#theImage').attr('src', 'image.jpg').load(function() {
alert('This Image Has Been Loaded');
});
</pre>
</li>
<li>
<h2>How to namespace events using jQuery:</h2>
<pre name="code" class="javascript">

//Events can be namespaced like this
$('input').bind('blur.validation', function(e){
    // ...
});

//The data method also accept namespaces
$('input').data('validation.isValid', true);
</pre>
</li>
<li>
<h2>How to Check if Cookies Are Enabled Or Not:</h2>
<pre name="code" class="javascript">
    var dt = new Date();
    dt.setSeconds(dt.getSeconds() + 60);
    document.cookie = &quot;cookietest=1; expires=&quot; + dt.toGMTString();
    var cookiesEnabled = document.cookie.indexOf(&quot;cookietest=&quot;) != -1;
    if(!cookiesEnabled)
	{
        //cookies have not been enabled
    }
</pre>
</li>
<li>
<h2>How to Expire A Cookie:</h2>
<pre name="code" class="javascript">
var date = new Date();
date.setTime(date.getTime() + (x * 60 * 1000));
$.cookie('example', 'foo', { expires: date });
</pre>
</li>
<li>
<h2>Replace any URL on your page with a clickable link</h2>
<pre name="code" class="javascript">
$.fn.replaceUrl = function() {
        var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&amp;%@!\-\/]))?)/gi;
        this.each(function() {
            $(this).html(
                $(this).html().replace(regexp,'<a href="$1">$1</a>&lsquo;)
            );
        });
        return $(this);
    }  

	//usage

	$('p').replaceUrl();
</pre>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/50-jquery-snippets-for-developers/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>jQuery Fubar &#8211; How To Create A Website Toolbar From Scratch And Add Widgets To It</title>
		<link>http://addyosmani.com/blog/jquery-fubar-how-to-create-a-website-toolbar-from-scratch-and-add-widgets-to-it/</link>
		<comments>http://addyosmani.com/blog/jquery-fubar-how-to-create-a-website-toolbar-from-scratch-and-add-widgets-to-it/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 16:53:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[addyosmani.com]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fan page]]></category>
		<category><![CDATA[fixed position toolbar]]></category>
		<category><![CDATA[fixed-position]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[footer bar]]></category>
		<category><![CDATA[footer toolbar]]></category>
		<category><![CDATA[fubar sitebar]]></category>
		<category><![CDATA[fubar toolbar]]></category>
		<category><![CDATA[google buzz]]></category>
		<category><![CDATA[javascript fixed position toolbar]]></category>
		<category><![CDATA[javascript toolbar]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery fixed-position css toolbar]]></category>
		<category><![CDATA[jquery fubar]]></category>
		<category><![CDATA[jquery plugins]]></category>
		<category><![CDATA[jquery toolbar]]></category>
		<category><![CDATA[jquery toolbar for your website]]></category>
		<category><![CDATA[jquery ui]]></category>
		<category><![CDATA[meebo bar]]></category>
		<category><![CDATA[meebo website bar]]></category>
		<category><![CDATA[mysitebar]]></category>
		<category><![CDATA[prettyphoto]]></category>
		<category><![CDATA[sitebar]]></category>
		<category><![CDATA[toolbar]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[website bar]]></category>
		<category><![CDATA[website bottom bar]]></category>
		<category><![CDATA[website footer bar]]></category>
		<category><![CDATA[website sharing]]></category>
		<category><![CDATA[website sharing bar]]></category>
		<category><![CDATA[website social bar]]></category>
		<category><![CDATA[website toolbar]]></category>
		<category><![CDATA[wibiya]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/jquery-fubar-how-to-create-a-website-toolbar-from-scratch-and-add-widgets-to-it/</guid>
		<description><![CDATA[
&#160;
Over the past year, we&#8217;ve seen website toolbar&#8217;s become an increasingly popular way for site-owners to offer users a consistent set of powerful social features, regardless of what page they&#8217;re on &#8211; Share, Subscribe, Tweet, Talk &#8211; you name it and chances are there&#8217;s a toolbar out there that offers some variation of these features. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://addyosmani.com/blog/jquery-fubar-how-to-create-a-website-toolbar-from-scratch-and-add-widgets-to-it/#myPosts"><img width="530" height="342" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/fubars.jpg" alt="fubars" style="border-width: 0px; display: inline;" title="fubars" /></a></p>
<p>&nbsp;</p>
<p>Over the past year, we&#8217;ve seen website toolbar&#8217;s become an increasingly popular way for site-owners to offer users a consistent set of powerful social features, regardless of what page they&#8217;re on &#8211; Share, Subscribe, Tweet, Talk &#8211; you name it and chances are there&#8217;s a toolbar out there that offers some variation of these features. Facebook were one of the first companies to introduce this toolbar concept and have been the source of inspiration for many others.&nbsp;</p>
<p>&nbsp;</p>
<p>Taking a leaf from their book, companies like <a href="http://www.wibiya.com">Wibiya</a> and <a href="http://www.meebo.com">Meebo</a> have been at the forefront of a toolbar-for-the masses revolution, offering easily customizable widgets for almost anyone to install on their pages. Larger companies have also been hopping onto the toolbar-band too, with sites like <a href="http://www.cnet.com">CNET.com</a> embracing this concept as a way to offer their visitors more ways to interact with their site.</p>
<p>&nbsp;</p>
<p>In today&#8217;s post, I&#8217;m going to show you how to create your <i>very own</i> jQuery-powered website toolbar and then we&#8217;re going to pack it full of lots of useful widget features such as those found in the Wibiya-toolbar &ndash; I call it <a href="http://addyosmani.com/resources/sitebar/final-alt.html">jQuery Fubar</a>.</p>
<p>&nbsp;</p>
<p><span id="more-411"></span></p>
<p><b><font size="4">What Site-bars Our There At The Moment?</font></b></p>
<p>&nbsp;</p>
<p>As I mentioned, we&rsquo;ve all seen the widget-packed Wibiya Toolbar in action and they&rsquo;ve recently moved from their invite-only model to being fully open to the public. Meebo (the popular web destination for online IM services) also started offering their own version of this toolbar and both of them offer something a little different (Meebo for example includes a pretty funky drag-and-share feature). Today, we&rsquo;ve going to create our very own awesome website toolbar, but from a design perspective here&rsquo;s how the Meebo and Wibiya bars look close-up.</p>
<p>&nbsp;</p>
<p><strong>Wibiya</strong></p>
<p>&nbsp;</p>
<p><a href="http://addyosmani.com/blog/wp-content/uploads/2010/02/image1.png" class="thickbox"><img width="484" height="48" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image_thumb.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a>&nbsp;</p>
<p><strong>Meebo </strong></p>
<p>&nbsp;</p>
<p><a href="http://addyosmani.com/blog/wp-content/uploads/2010/02/image2.png" class="thickbox"><img width="488" height="45" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image_thumb1.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Now that we know what we&rsquo;re aiming for, let&rsquo;s see how easy it can be to put together something like this ourselves.</p>
<p>&nbsp;</p>
<p><img width="545" height="342" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/fubar_part1.jpg" alt="fubar_part1" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="fubar_part1" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><b><font size="4">The First Step &ndash; Fixed Positioning with CSS</font></b></p>
<p><b>     <br />
</b></p>
<p>The first step in creating a website-toolbar is creating an empty div which can be correctly fixed-positioned at the bottom of any webpage. The HTML for this is:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;div id<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;content&quot;</span><span style="color: #00AA00;">&gt;</span>&amp;nbsp<span style="color: #00AA00;">;</span>&lt;/div<span style="color: #00AA00;">&gt;</span>
&nbsp;
&lt;div id<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;floatingbar&quot;</span><span style="color: #00AA00;">&gt;</span>&lt;ul<span style="color: #00AA00;">&gt;</span> &lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Item name&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span> &lt;br /<span style="color: #00AA00;">&gt;</span>&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Item name&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span> &lt;br /<span style="color: #00AA00;">&gt;</span>&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Item name&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span> &lt;br /<span style="color: #00AA00;">&gt;</span>&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Item name&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span> &lt;br /<span style="color: #00AA00;">&gt;</span>&lt;/ul<span style="color: #00AA00;">&gt;</span>&lt;/div<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>&nbsp;</p>
<p>and the CSS for this can be found below.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">  div<span style="color: #cc00cc;">#floatingbar</span>
    <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>	
    <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media screen</span>
  <span style="color: #00AA00;">&#123;</span>
  body&amp;gt<span style="color: #00AA00;">;</span>div<span style="color: #cc00cc;">#floatingbar</span>
    <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p>Whilst fixed-positioning isn&#8217;t very difficult to achieve using browsers like FireFox and Chrome, it&#8217;s been notoriously buggy to code for Internet Explorer 6. Thankfully TagSoup came up with <a href="http://tagsoup.com/cookbook/css/fixed/">this</a> wonderful set of CSS/JS hackswhich claim to support fixed-positioning all the way back to IE5. If you&#8217;re creating a toolbar from scratch, I would definitely recommend reading their post as it&#8217;ll save you a lot of time later on. The IE Fix for this is:</p>
<p>&nbsp;</p>
<p><b>JavaScript/HTML:</b></p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;css/fixed4ie.css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>onload = function() { 
content.focus() }
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

<p><b>CSS:</b></p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body
  <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#content</span>
  <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p><b><font size="4">Once you&#8217;ve got your basic-toolbar in place&hellip;</font></b></p>
<p><b>     <br />
</b></p>
<p>The next thing you&#8217;re going to want to do is begin adding in some basic styling around it. Most website-toolbars are around the same dimension in height (although there is no official &ldquo;standard&rdquo;) so I&#8217;m going to set the height of my component as well as some very basic skinning and CSS to style my list items. The background design is made possible with a blue gradient PNG that has some light shadows added to it &#8211; similar to the kind of design Wibiya have gone for. Although CSS3 could be just as equally used to create this effect, remember that some people still use IE!</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div<span style="color: #cc00cc;">#floatingbar</span>
    <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">38px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span>Arial<span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'../images/tui.png'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>	
    <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#floatingbar</span> ul <span style="color: #00AA00;">&#123;</span> 
<span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#floatingbar</span> ul li 
<span style="color: #00AA00;">&#123;</span> 
<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">14px</span><span style="color: #00AA00;">;</span> 
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">-3px</span><span style="color: #00AA00;">;</span>  
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#floatingbar</span> ul li a 
<span style="color: #00AA00;">&#123;</span> 
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> 
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span> 
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span>Arial<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#floatingbar</span> ul li a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000033</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p>Now that this is done, I also want to add some basic animation to my toolbar so that when users first load up their page, the bar will slide up from the bottom. This is made possible using jQuery&#8217;s great animate() feature by keeping the initial height of the component at 0 and then tweening it up to it&#8217;s maximum height over a period of time. The code for this can be found below</p>
<p>&nbsp;</p>
<p><b>CSS:</b></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div<span style="color: #cc00cc;">#floatingbar</span>
    <span style="color: #00AA00;">&#123;</span>  
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>	
    <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><b>JavaScript:</b></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span> 
  $<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#floatingbar'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> height<span style="color: #339933;">:</span> <span style="color: #3366CC;">'38'</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>&nbsp;</p>
<p>This will end up creating something a little like <a href="http://addyosmani.com/resources/sitebar/step1.html">this</a></p>
<p>&nbsp;</p>
<p>
<b><font size="4">Next, populate the toolbar with some links and some more jQuery Magic</font> </b></p>
<p><b>     <br />
</b></p>
<p>In the next step of development, we&rsquo;re going to add some nice visual effects to the toolbar, with the assistance of two of my favorite jQuery plugins &ndash; the first will provide us with some lightweight tooltips for our toolbar items whilst the second is going to be used for displaying our content.</p>
<p>&nbsp;</p>
<p><a name="Details">1.<b> jQuery Tipsy Tooltips </b>for Toolbar Elements &#8211; This is a plugin used for adding Facebook-Like Tooltip effects to your site or links (</a><a href="http://onehackoranother.com/projects/jquery/tipsy/">http://onehackoranother.com/projects/jquery/tipsy/</a>)</p>
<p>&nbsp;</p>
<p><strong>Sample Usage:</strong></p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span> 
  $<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.toolbarLink'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tipsy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>gravity<span style="color: #339933;">:</span> <span style="color: #3366CC;">'s'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>&nbsp;</p>
<p>2.<b> jQuery PrettyPhoto </b>- This is a lightbox alternative that allows you to display any type of content, in particular, iFrame content from local or external websites (<a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/" title="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/</a>)</p>
<p>&nbsp;</p>
<p><strong>Sample Usage:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> charset<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;utf-8&quot;</span><span style="color: #339933;">&gt;</span>
  $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.gallery a[rel^='prettyPhoto']&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prettyPhoto</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>theme<span style="color: #339933;">:</span><span style="color: #3366CC;">'facebook'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p><b><font size="4">Let&#8217;s start adding some social features to the toolbar</font></b></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img width="520" height="401" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/addingos.jpg" alt="addingos" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="addingos" /></p>
<p><b>     <br />
</b></p>
<p>When I first looked at the Wibiya toolbar, the big features that appealed to me were how easy it made it for any user to interact with all of the social networks associated with a website. I could easily take a look at the site&#8217;s Twitter account or become a fan of their Facebook Fan page, I could even easily browse through all their pictures without having to leave the page I was on. That &quot;ease&quot; of access impressed me, so I developed my website toolbar with widgets in mind.</p>
<p>&nbsp;</p>
<p>When there are so many different ways currently available to pull in your recent tweets or display your Flickr albums in an easily scrollable box, why not find an implementation you like and just customize it?. So, that&#8217;s what we&#8217;re going to do.</p>
<p>&nbsp;</p>
<p>1. <b>Google Buzz Plugin</b> &#8211; Mike More&#8217;s excellent Google Buzz Widget grabs the feed of your latest Google Buzz posts and refreshes this list depending on a set of parameters you&#8217;ve configured (<a href="http://www.moretechtips.net/2010/02/google-buzz-widget-jquery-plugin.html">http://www.moretechtips.net/2010/02/google-buzz-widget-jquery-plugin.html</a>)</p>
<p>&nbsp;</p>
<p>2. <b>Sea of Clouds jQuery Twitter Plugin</b> &#8211; This wonderfully compact plugin makes pulling your Twitter feeds a piece of cake and also allows you to customize the output quite extensively (<a href="http://tweet.seaofclouds.com/">http://tweet.seaofclouds.com/</a>)</p>
<p>&nbsp;</p>
<p>3. <b>Facebook Fan Page Widget </b>- The Facebook Fan Page Widget is a widget provided free by Facebook to site owners wishing to share their fan streams or followers in a box on their website. To allow you to show to Fan Box widgets side by side as in the original Wibiya bar, one can either choose to proxy one of the content boxes or load each of the widgets in separate iFrames which are then loaded into the same window.</p>
<p>&nbsp;</p>
<p>4. <b>Coolris Express Viewer -</b> CoolIris offer the public a <a href="http://www.cooliris.com/express">free</a> version of their commercial 3D-Wall Component for use on your own personal sites. They&#8217;ve got a fantastic widget generator online that lets you pull in feeds from all sorts of sources including Flickr, YouTube or your own RSS Feed. It then takes this information and renders it as a scrollable wall of thumbnails that&#8217;s easy to view.</p>
<p>&nbsp;</p>
<p>5. <b>AddToAny Subscription and Share Widgets</b> &#8211; These excellent widgets allow you to configure everything down to the event handlers that execute them so you can choose whether they appear on click or on mouse over. All the usual share sites and social networks are included and these guys even offer an API to anyone wishing to do more with their code.</p>
<p>&nbsp;</p>
<p>6. <b>ConveyThis.com Translation Features</b> &#8211; Google Translate has been a favorite service among many of my fellow coders for a while now, but I came across this great service that allows you to give your visitors the choice to pick what translation service they want to use to translate your page once they&#8217;ve selected a language. Because some services have stronger features in one area of language than others, your visitors will have all the options they could want available to them. ConveyThis<a href="http://code.google.com/p/jquery-sitebar/w/edit/ConveyThis">?</a> also has a great widget you can add easily to your site, so definitely check it out.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><b><font size="4">Widget Delivery</font></b></p>
<p><b>     <br />
</b></p>
<p>Widgets (or plugins such as a Twitter-Reader or Translation service) can be delivered to our visitors through the site-bar in two main methods. The first is on page-load and the second is dynamically on-demand. The second of these options is the most beneficial as it means that we only have to load up the plugin when a user requests it. This can be either done through Ajax-Calls or iFrames.</p>
<p>&nbsp;</p>
<p>In my implementation I have opted for iFrames through the PrettyPhoto Light-Box plugin &#8211; I thought this was a good idea because it provides a nice sandboxed area where the widget can execute as required without the chance of it interfering with the other widgets on the page. Whilst this isn&#8217;t a problem for most modern browsers, sandboxing widgets into iFrames can help lower the bug rate for older browsers like IE6.</p>
<p>&nbsp;</p>
<p>To host a widget inside a lightbox iFrame, all you need to do is write or paste the code for it, once configured, into a new html file, save it into a local file in your toolbar directory and call it via PrettyPhoto as follows:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;prettyPhoto[iframe]&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;widget.html&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Here's the tooltip text &quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;toolbarLink&quot;</span>&gt;</span> My Page<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>You can then freely call any widget file, with it&rsquo;s very own themes if desired the same way you would any other link used from a lightbox. prettyPhoto also includes some pagination by default so if you want to easily flick through all of the widgets available on your toolbar you can do so through the controls at the bottom of the lightbox.</p>
<p>&nbsp;</p>
<p><font size="4"><strong>Further Customization &amp; Demos</strong></font></p>
<p>&nbsp;</p>
<p>It&rsquo;s possible to further customize your toolbar by adding in icons next to each of your widget links and floating them accordingly. For the example in today&rsquo;s post, I&rsquo;ve used some fantastic 24&#215;24 icons from <a href="http://www.iconfinder.net">iconfinder.net</a>, and you can see the final version of this page <a href="http://addyosmani.com/resources/sitebar/final-basic.html">here</a> (or click below to expand the screenshot).</p>
<p>&nbsp;</p>
<p><a href="http://addyosmani.com/blog/wp-content/uploads/2010/02/image3.png" class="thickbox"><img width="508" height="244" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image_thumb2.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>You can also take your imagination one step further and replace all of the text in your toolbar with some nice images &ndash; I personally spent a few minutes putting together some gradient text in PhotoShop and <a href="http://addyosmani.com/resources/sitebar/final-alt.html">here&rsquo;s</a> what the final product looked like.</p>
<p>&nbsp;</p>
<p><a href="http://addyosmani.com/blog/wp-content/uploads/2010/02/image4.png" class="thickbox"><img width="510" height="243" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image_thumb3.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>With a little more work you could easily add some nice toggle buttons to the side of the toolbar to allow visitors to open or close it and there are a lot more widgets out there that you could experiment adding to your version.</p>
<p>&nbsp;</p>
<p>and that&rsquo;s it!. If you found today&rsquo;s tutorial helpful, let me know in the comments section below.</p>
<p>&nbsp;</p>
<p><strong><font size="4">Download All Of Todays Examples</font></strong></p>
<p>&nbsp;</p>
<p>You can download all of today&rsquo;s examples including both the CSS/Icons version of Fubar as well as the Graphics version from the link below. All widgets can be obtained or generated from the site&rsquo;s referenced in the list earlier in the article, but I&rsquo;m also including my own ones in the example pack so you can see how easy it is to get setup.</p>
<p>&nbsp;</p>
<p><a href="http://jquery-sitebar.googlecode.com/files/sitebar.rc1.zip"><img width="240" height="77" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/dlbutton.jpg" alt="dlbutton" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="dlbutton" /></a>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><font size="4">Bonus: Fixed-Position Website Toolbar Plugins</font></strong></p>
<p>&nbsp;</p>
<p>As a bonus to today&rsquo;s post, I&rsquo;m also sharing some of the best out-of-the-box alternative solutions and tutorials available for creating your own customized fixed-position Site Bar. We all know that Wibiya is great for a one-click solution, but if you need something a little different one of these will definitely be able to help if the tutorial above doesn&rsquo;t give you what you&rsquo;re after.</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.pvmgarage.com/en/2009/12/nice-and-simple-toolbar-for-your-website-with-css3-and-jquery/">CSS3 Fixed-Position Toolbar for your site with Social Networking Icons</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.pvmgarage.com/en/2009/12/nice-and-simple-toolbar-for-your-website-with-css3-and-jquery/"><img width="532" height="227" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image5.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>Learn how to create a fantastic fixed footer toolbar for your site &ndash; this version includes some usefully placed social networking and subscription icons, great eye-candy tooltip effects and a complete tutorial on how to create it from start to finish. CSS3 Effects compliment it further with some nice visual design touches. Recommended for those who aren&rsquo;t looking for extensive changes in customization to the above design and currently have more of a functionality requirement.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.sohtanaka.com/web-design/examples/footer-panel/"><strong>Facebook Style Footer-Toolbar from Soh Tanaka</strong></a></p>
<p>&nbsp;</p>
<p><a href="http://www.sohtanaka.com/web-design/examples/footer-panel/"><img width="535" height="215" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image6.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>Soh Tanaka presents this excellent tutorial on how to create a Facebook Style Fixed Site Footer toolbar. This implementation is very close to how the real Facebook site-bar looks and feels and even includes a follow-up tutorial on how to create a pop-out Friends List Chat bar. Recommended for those looking for a fully-featured example of how to create a floating site toolbar for further customization.</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.bennadel.com/blog/1740-Building-A-Fixed-Position-Bottom-Menu-Bar-ala-FaceBook-.htm">Floating Footer Toolbar</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.bennadel.com/blog/1740-Building-A-Fixed-Position-Bottom-Menu-Bar-ala-FaceBook-.htm"><img width="515" height="238" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image7.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>This entry from Ben Nadel, the most barebones of my recommended tutorials for today, will show you how to build a very very simple implementation of a floating site toolbar. This doesn&rsquo;t include any of the sample icons or buttons that Soh Tanaka&rsquo;s version above does so if you want an example that you can literally just start adding your own content to, this would be the one to get.&nbsp; Ben&rsquo;s version has been tested with many browsers including IE6, so cross browser compatibility won&rsquo;t be an issue!.</p>
<p>&nbsp;</p>
<p><strong>J<a href="http://ryan.rawswift.com/sandbox/jixedbar-0.0.2/demo/">ixedBar &ndash; A Fixed-Position Toolbar plugin for jQuery</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://ryan.rawswift.com/sandbox/jixedbar-0.0.2/demo/"><img width="511" height="212" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image8.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>Here&rsquo;s a recently updated plugin that takes a lot out of the effort out of creating a fixed-position toolbar for your site. All you need to do is create a &lt;ul&gt; /&lt;li&gt; structure for each split section and then have the plugin transform it into the toolbar for you. It&rsquo;s a hassle-free way of adding this feature to your projects and at under 7KB, it&rsquo;s definitely a recommended download.</p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/jquery-fubar-how-to-create-a-website-toolbar-from-scratch-and-add-widgets-to-it/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Fluid Navigation &#8211; How to create an informative menu-bar with jQuery &amp; CSS</title>
		<link>http://addyosmani.com/blog/fluid-navigation-how-to-create-an-informative-menu-bar-with-jquery-in-just-a-few-minutes/</link>
		<comments>http://addyosmani.com/blog/fluid-navigation-how-to-create-an-informative-menu-bar-with-jquery-in-just-a-few-minutes/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 22:03:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Under 10 Minutes]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[creative menu]]></category>
		<category><![CDATA[fluid navigation]]></category>
		<category><![CDATA[javascript menus]]></category>
		<category><![CDATA[javasript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery creative menu]]></category>
		<category><![CDATA[jquery drop down]]></category>
		<category><![CDATA[jquery drop-down navigation]]></category>
		<category><![CDATA[jquery information]]></category>
		<category><![CDATA[jquery informative menu]]></category>
		<category><![CDATA[jquery menu]]></category>
		<category><![CDATA[jquery menus]]></category>
		<category><![CDATA[jquery navigating]]></category>
		<category><![CDATA[jquery navigation tutorial]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/fluid-navigation-how-to-create-an-informative-menu-bar-with-jquery-in-just-a-few-minutes/</guid>
		<description><![CDATA[&#160;
&#160;
After a few weeks away in the US, I&#8217;m back with a brand new jQuery post &#8211; this week taking a look at a new style of navigation menu. jQuery has made it simple for developers to define an idea or wireframe for a component and then implement it reasonably quickly, which has certainly helped [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;<a href="http://addyosmani.com/blog/fluid-navigation-how-to-create-an-informative-menu-bar-with-jquery-in-just-a-few-minutes/#myPosts"><img border="0" src="http://addyosmani.com/blog/wp-content/uploads/fluia.jpg" alt="fluia" style="border: 0px none ; display: inline;" title="fluia" /></a></p>
<p>&nbsp;</p>
<p>After a few weeks away in the US, I&rsquo;m back with a brand new jQuery post &ndash; this week taking a look at a new style of <a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.html">navigation menu</a>. jQuery has made it simple for developers to define an idea or wireframe for a component and then implement it reasonably quickly, which has certainly helped it become the most popular JavaScript Framework out there at the moment. I feel like some of the navigation options out there right now don&rsquo;t provide you with enough information about the sections of a site you can visit, so today we&rsquo;re going to learn how to create a menu that solves this problem.&nbsp;</p>
<p>&nbsp;</p>
<p><span id="more-394"></span></p>
<p><a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.html">Here&rsquo;s</a> what we&rsquo;re going to be creating in it&rsquo;s final form.</p>
<p>&nbsp;</p>
<p><a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.html"><img width="550" height="298" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/image.png" alt="image" style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>First, I&rsquo;m going to define what the menu can do and we&rsquo;ll take a look at a rough wireframe I created using <a href="http://www.mockflow.com">MockFlow</a>&rsquo;s free wireframe generator. We want to create a menu that appears like a standard menu bar in it&rsquo;s default state, but which on rollover pulls down an information area that covers both the original menubar item and has an expanded section containing the text we want to display. This can be seen in the wireframe below.</p>
<p>&nbsp;</p>
<p><a href="http://addyosmani.com/blog/wp-content/uploads/2010/02/Fluid_Menu.png" class="thickbox"><img width="541" height="219" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2010/02/Fluid_Menu_thumb.png" alt="Fluid_Menu" style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="Fluid_Menu" /></a></p>
<p>&nbsp;</p>
<p>Next, let&rsquo;s begin to create this menu using some basic HTML structure and CSS. We&rsquo;re going to need a holder for the menu, the menu itself, each item and a div for each of the drop-down elements we&rsquo;re going to display information in.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuBarHolder&quot;</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuBar&quot;</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;firstchild&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Home<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the home section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Services<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the services section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Clients<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the clients section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Portfolio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the portfolio section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>About<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the about section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Blog<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the blog section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Follow<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the follow section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:#&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menuInfo&quot;</span>&gt;</span>I am some text about the contact section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>We&rsquo;re now going to style this content. Because we only want to display the extra information for each section when a user hovers over an &ldquo;li&rdquo; element, we&rsquo;re going to hide the information divs until they&rsquo;re needed. I&rsquo;ve also noticed that a lot of the popular browsers you guys use (IE aside) support CSS rounded corners, so I&rsquo;m including this effect to be used for the drop-down menus &#8211; it&rsquo;s visually more pleasing to the eye than corners in some designs, and if you&rsquo;d prefer you can drop the last few terms in the &ldquo;menuInfo&rdquo; class.</p>
<p>&nbsp;</p>
<p>This menu is completely cross-browser compatible (yay!) so it&rsquo;s possible to use rounded corner definitions without needing to worry about how they&rsquo;ll render in older browsers &ndash; everything should gracefully degrade as per necessary.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&nbsp;
<span style="color: #cc00cc;">#menuBarHolder</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">730px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">45px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span>Arial<span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">14px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menuBarHolder</span> ul<span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menuBar</span> li<span style="color: #00AA00;">&#123;</span>  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">50px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menuBar</span> li a<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span><span style="color: #933;">-1px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.menuHover</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.firstchild</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.menuInfo</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span>hand<span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">74px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">11px</span><span style="color: #00AA00;">;</span>height<span style="color: #00AA00;">:</span><span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">-15px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">-15px</span><span style="color: #00AA00;">;</span>
-moz-border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
-moz-border-radius-bottomleft<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
-webkit-border-bottom-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
-webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
-khtml-border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
-khtml-border-radius-bottomleft<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
 border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
border-radius-bottomleft<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p style="text-align: center;"><img width="459" height="229" alt="" src="http://addyosmani.com/blog/wp-content/uploads/menus.jpg" /></p>
<p>Finally, let&rsquo;s take a look at the jQuery for our Fluid Menu. We want to add hover cases to each element of our menu so that when a user moves their mouse over a menu-item, the information div animates into place elegantly. To achieve this, we&rsquo;re simply going to use jQuery&rsquo;s built-in slideDown and slideUp effects as they provide the most efficient way to achieve the effect we want with the least amount of code.</p>
<p>&nbsp;</p>
<p>We also want users to be able to click on the entire &ldquo;li&rdquo; element rather than the links inside them, so we&rsquo;re going to bind a pseduo-click event to all the menu&rsquo;s li&rsquo;s by means of document.location.href and an attribute check on the href of their child links.This is achieved as follows:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#menuBar li'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> url <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  document.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> url<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#menuBar li'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.menuInfo'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.menuInfo'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&nbsp;</p>
<p>and that&rsquo;s it!. You can now easily set additional information for any of the menu items in your menu-bar and if needed you can easily extend the length of the drop-downs to suit your needs. You can find a demo and download links to all of the code in today&rsquo;s post below.</p>
<p>&nbsp;</p>
<p><strong>Demo:</strong> <a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.html">http://addyosmani.com/resources/fluid-menu/fluid-menu.html</a></p>
<p><strong>Download:</strong> <a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.zip">http://addyosmani.com/resources/fluid-menu/fluid-menu.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/fluid-navigation-how-to-create-an-informative-menu-bar-with-jquery-in-just-a-few-minutes/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>13 jQuery User Interface Tutorials To Improve Your Designs</title>
		<link>http://addyosmani.com/blog/13-jquery-user-interface-tutorials-to-improve-your-designs/</link>
		<comments>http://addyosmani.com/blog/13-jquery-user-interface-tutorials-to-improve-your-designs/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 03:53:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/13-jquery-user-interface-tutorials-to-improve-your-designs/</guid>
		<description><![CDATA[ 
&#160;
Hi guys. Today I wanted to share with you interface tutorials for some of the ideas I’ve found quite inspiring over the past few weeks. In this post you’ll find tutorials that will teach you how to create easily switchable gallery views, a 3D rotating share button carousel, the Facebook Admin Panel and much [...]]]></description>
			<content:encoded><![CDATA[<p><img title="interfacetuts" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="342" alt="interfacetuts" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/interfacetuts.jpg" width="530" border="0" /> </p>
<p>&#160;</p>
<p>Hi guys. Today I wanted to share with you interface tutorials for some of the ideas I’ve found quite inspiring over the past few weeks. In this post you’ll find tutorials that will teach you how to create easily switchable gallery views, a 3D rotating share button carousel, the Facebook Admin Panel and much more. We often come across small pieces of design that make us pause and think .. “Wow. I really want to do that..” so I hope that this post goes a little way towards helping you add a few special touches to your own interfaces.</p>
<p>&#160;</p>
<p> <span id="more-388"></span>
<p>Before we begin, I just want to let everyone know that I’m currently working on a really interesting post on how to create brand new User Interface form elements based on the logic *you* define. Think about radio buttons that have more than just two states or checkboxes which do more than just check or uncheck. It’s a topic I don’t believe has been covered in depth anywhere else before so hopefully it will be a good read. I’m hoping to have it finished some time this week so stay tuned for some more jQuery action soon!. Anyway.. let’s charge forward with this post.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://swizec.com/code/styledButton/"><strong>How to create the image-less from Google.com</strong></a></p>
<p>&#160;</p>
<p>Recently, Google invested in a team of graphic designs and engineers for one simple goal – to create a set of form buttons that had all the style of their image-counterparts but didn’t actually contain any (really..a whole team? Yipes). The benefit of this is that they created visually appealing buttons through CSS and could thus offer users a fast homepage experience regardless of whether they were browsing using broadband, 3G or something slower. You don’t need CSS3 or any specific next-gen features in your browser to make these buttons work which is why they fascinated me when I read about them. This tutorial will teach you how to re-recreate the Google image-less buttons and it’s certainly worth checking out.</p>
<p>&#160;</p>
<p></a><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="146" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb.png" width="482" align="left" border="0" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://designm.ag/tutorials/jquery-display-switch/"><strong>How to Create an Image Gallery with easily Switchable Views</strong></a></p>
<p>&#160;</p>
<p>Renowned developer Soh Tanaka provides this slick and very easy to learn technique for offering your users a variety of “switchable” views for your image galleries. It effectively allows you to choose whether you want to see images as a list with detailed information, as a gallery of just images or as a list of pure links. Putting the choice of view style in the hands of you users is a very powerful tool and this tutorial will teach you exactly how to implement it. Recommended reading.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="259" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb1.png" width="494" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://tutorialzine.com/2009/12/animated-share-buttons-jquery-css/"><strong>An Animated Sharing-Bar that includes a 3D Carousel Effect</strong></a></p>
<p>&#160;</p>
<p>Sharing features are important for just about any blog, but in a lot of cases you’ll find site-owners using the same boring layout and UI to display theirs (no comment on mine!)– this is usually some variation of a row of icons, but wouldn’t it be interesting if we spiced that up a little?. This excellent tutorial from TutorialZine harnesses the power of 3D Carousels to display share buttons in a way that definitely catches your attention with both animation and reflection effects through into the mix thanks to some jQuery. A good read.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="223" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb2.png" width="452" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://www.sohtanaka.com/web-design/facebook-style-footer-admin-panel-part-1/"><strong>Facebook Style Footer Admin Panel with CSS and jQuery</strong></a></p>
<p>&#160;</p>
<p>Bottom navigation bars are becoming a trend with Facebook, MySpace and now the Wibiya toolbar offering users a consistent way to interact with a site. This excellent tutorial will teach you how to implement your own Footer Admin Panel and it’s very comprehensive.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/01_finalDemo.gif"><img title="01_finalDemo" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="264" alt="01_finalDemo" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/01_finalDemo_thumb.gif" width="467" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://www.filamentgroup.com/lab/update_styling_the_button_element_with_css_sliding_doors_now_with_image_spr/"><strong>How to use the Sliding-Doors Technique to create buttons using Sprites</strong></a></p>
<p>&#160;</p>
<p>Image Sprites are a great way to decrease the number of images your page needs to download, but did you know that there’s an easy way to use sprites to create buttons of any length for your site?. I’ve had to deal with this problem lots of times, and let me tell you guys – there is nothing worse than having to constrict the text you use in a button just because you don’t want to create a static image for it and your background image isn’t long enough to fit behind. Well..perhaps herpes, but I’m trying to be serious here. This great tutorial shows you how you can create buttons of any size using the same Sprite image with all the bells and whistles you need. A recommended bookmark.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image3.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="173" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb3.png" width="451" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://www.geektantra.com/2009/09/jquery-mega-menu/"><strong>jQuery Mega-Menu with slide-down effects</strong></a></p>
<p>&#160;</p>
<p>Mega-menu’s offer a richer navigation experience, allowing developers and site-owners to offer users a much more in-depth view of the pages available on a site. Where previously a site-map may be used for this purpose, we’re now finding that a lot of this content can be neatly categorized and placed in a Mega-Menu instead.&#160; This excellent tutorial will show you exactly how to add a slick mega-menu to your site in no time.</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image4.png"><img title="image" style=<br />
"border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="168" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb4.png" width="454" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://www.webresourcesdepot.com/fly-to-basket-effect-with-jquery/"><strong>jQuery Fly-To-Basket Effect for Online Stores</strong></a></p>
<p>&#160;</p>
<p>The Fly-to-basket effect was something I first saw done in Flash a few years ago and now it’s available in jQuery with all it’s cross-browser compatible glory. This is an excellent example of how to make your user interface feel more interactive and the effect is surprisingly easy to achieve. This effect has been popping up on quite a few sites recently and I’m sure that the code-samples will come in useful for anyone currently thinking of adding this to their site. For a comprehensive tutorial, hit the link above.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image5.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="156" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb5.png" width="456" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://demo.tutorialzine.com/2009/11/fancy-quotes/demo.php"><strong>Fancy Quotes using jQuery, CSS and Ajax</strong></a></p>
<p>&#160;</p>
<p>This is an excellent tutorial that will show you how to provide your users a way to scroll through a large list of content without having to click through any scrollbars at all – mouse movements control most of the UI. Admittedly, it can take a few moments to get used to the interface, but I could easily imagine it being used to rate or view all sorts of content. Everything from the latest tweets about Britney Spears latest wig to financial stock tips – This a UI that minimizes necessary interaction and maximises the content that can be displayed in a very small space. A+ in my books.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image6.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="222" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb6.png" width="478" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://www.givainc.com/labs/ibutton_example.htm"><strong>GivaLabs iButtons – a different way of displaying your checkbox</strong></a></p>
<p>&#160;</p>
<p>Whilst Giva aren’t the first group to try creating a “switch-like” alternative to the standard checkbox, they have turned it into something of an art, including animations of all sorts into the mix and in general making the element appear a lot more interactive than previous iterations. Switches aren’t for everyone, but these examples are worth looking at if from a UI elements perspective if nothing else. Recommended reading.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image7.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="148" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb7.png" width="458" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://trentrichardson.com/Impromptu/index.php"><strong>jQuery Impromptu – A Sleek, light-weight and simple way to add user-prompts</strong></a></p>
<p>&#160;</p>
<p>What I like about Impromptu is that it was build from the ground-up specifically for the purpose of providing developers with a sleek, easy way to display user prompts. Prompts are treated in the same way that JavaScript alerts are and you can define all of the mark-up for your prompt within jQuery, without needing to store it in a hidden div on some other part of the page. It’s an elegant solution and one I would certainly recommend to anyone developing Rich jQuery Applications.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image8.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="165" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb8.png" width="450" border="0" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.emblematiq.com/lab/niceforms/demo/"><strong>NiceForms – Easy Form Skinning for the masses</strong></a></p>
<p>&#160;</p>
<p>NF is a nice alternative to using jQuery UI and ThemeRoller to skin your everyday forms. It’s relatively light-weight and allows you to easily skin an entire form using just JavaScript and some CSS without needing to do a lot of manual work to add the right class names to all your elements. One of the benefit’s it offers are beautified skinning of the radio, checkbox, select and input field elements and it helps you do this with little pain. I’d definitely recommend checking this out.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image9.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="172" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb9.png" width="464" border="0" /></a> </p>
<p>&#160;</p>
<p><a href="http://design-notes.info/tutorial/jquery-tutorial/make-fancy-light-up-rss-button-with-jquery-fading/"><strong>A Very Simple Change to your Layout – Fade in and Fade-out effects for main page icons</strong></a></p>
<p>&#160;</p>
<p>Fade-in and fade-out effects take less than 5 minutes to add to an image using jQuery, but from a user appreciation perspective, they’re fantastic. Sure, you’re not handing them a bucket of money, but users do notice things like animation effects on web-pages and icons are a perfect place where hover/fades are suitable. They don’t constrict the page or any functionality, gracefully degrade and are the type of eye-candy that can help your design pop-out.</p>
<p><strong></strong></p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image10.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="210" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb10.png" width="472" border="0" /></a></p>
<p>&#160;</p>
<p><a href="http://demo.tutorialzine.com/2009/12/colorful-content-accordion-css-jquery/demo.html"><strong>A Colorful Accordion with Bounce Effects</strong></a></p>
<p>&#160;</p>
<p>I’m not usually a big fan of Accordions because in a lot of cases I see them being used incorrectly. ie. “filling that spot” to the side of the page where developers replicate their top-navigation because they have nothing else to put there. My word..some people deserve to be chased into busy traffic. Anyway, there are a lot more intuitive ways of displaying navigational content so why am I including an accordion on this list you may ask. Well, to be honest it’s because these developers included a few very small, very subtle changes in this accordion such as the inclusion of animated bounce effects and a varying colour scheme which easily distinguishes every top-level category in a way other accordions sometimes fail to. Recommended for fans of the accordion.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2010/01/image11.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="222" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2010/01/image_thumb11.png" width="464" border="<br />
0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/13-jquery-user-interface-tutorials-to-improve-your-designs/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Extending CSS with jQuery &#8211; A New Year&#8217;s Guide</title>
		<link>http://addyosmani.com/blog/extending-css-with-jquery-a-new-years-guide/</link>
		<comments>http://addyosmani.com/blog/extending-css-with-jquery-a-new-years-guide/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 16:53:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css transforms]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[extend css]]></category>
		<category><![CDATA[extend css with jquery]]></category>
		<category><![CDATA[extending css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery css]]></category>
		<category><![CDATA[jquery tips]]></category>
		<category><![CDATA[jquery tools]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/extending-css-with-jquery-a-new-years-guide/</guid>
		<description><![CDATA[&#160;
&#160;

&#160;
Preface: Chris Coyier, of CSS-Tricks fame, recently gave an excellent presentation on how to extend CSS using jQuery. I remember seeing this wonderful presentation floating around recently but hadn&#8217;t been aware of who the author was until now. I would like to apologize to every one of my readers, including Chris, for posting this article [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/extending.jpg"><img title="page0" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" alt="page0" border="0" src="http://addyosmani.com/blog/wp-content/uploads/extending.jpg" /></a></p>
<p>&nbsp;</p>
<p><span style="color: rgb(51, 51, 51); "><strong>Preface: </strong>Chris Coyier, of CSS-Tricks fame, recently gave an excellent </span><a href="http://www.scribd.com/doc/23649844/Using-jQuery-to-Extend-CSS"><span style="color: rgb(51, 51, 51); ">presentation</span></a><span style="color: rgb(51, 51, 51); "> on how to extend CSS using jQuery. I remember seeing this wonderful presentation floating around recently but hadn&rsquo;t been aware of who the author was until now. I would like to apologize to every one of my readers, including Chris, for posting this article up without any reference to the slides author &ndash; my original online source didn&rsquo;t include any mention of him (or any author for that matter) so I had rather foolishly gone ahead with the use of them without investing more time into researching who put them up. This revised version of the article gives full credit to Chris who is indeed the man that gave the original presentation and was kind enough to give his permission for his slides to be used. I and this article would like to thank him for being the main inspiration behind this topic.</span></p>
<p>&nbsp;</p>
<p>Having viewed Chris&rsquo;s presentation, I thought I&rsquo;d write a post around it to help my readers see how jQuery helps us to extend CSS in ways that make our jobs a whole lot easier. I&rsquo;ve always thought that jQuery was extraordinary framework &#8211; allowing both web developers and designers an easy way to harness the full visual capabilities of JavaScript. One of the nicest advantages of jQuery has been ability to extend CSS beyond what was previously capable with simple mark-up alone. In this post, I&rsquo;m going to show you how to use jQuery to fix cross browser compatibility issues, solve some shortcomings with CSS, do things CSS just can&rsquo;t do on it&rsquo;s own and we&rsquo;ll finally also go through some real-world problems that will be useful to both those new to the framework and those coders who&rsquo;ve been using it for a while. I hope you find it helpful!.</p>
<p>&nbsp;</p>
<p><span id="more-356"></span></p>
<p>Before we leap in, let&rsquo;s take a look at <strong>why</strong> jQuery has come to be the most widely adopted of JavaScript frameworks. First, it&rsquo;s extremely designer friendly. In Chris&rsquo;s slide below you&rsquo;ll see some standard CSS mark-up &ndash; hover conditions, list elements &ndash; defining styles is very much a static process, but jQuery allows you to easily and instantly add or remove classes, conditions, functions and more to any element on your page so that it takes CSS to the next level &#8211; interactivity. jQuery also has a <strong>very</strong> short learning curve (which as some of us know) has meant that creating effects like boxes sliding up or down a page child&rsquo;s play.</p>
<p>&nbsp;</p>
<p>&nbsp;<a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page1.jpg"><img title="page-1" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-1" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page1_thumb.jpg" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Selectors and Pseudo Selectors</strong></p>
<p>&nbsp;</p>
<p>Selectors are one of the most important aspects of the jQuery library &#8211; these such selectors use familiar CSS syntax to allow page authors to quickly and easily identify any set of page elements to operate upon with the jQuery library methods. Understanding jQuery selectors is the key to using the jQuery library most effectively. Below you&#8217;ll see that an example of where in the past we would have used CSS selectors to define some styling for say, an input element.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img title="page-6" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-6" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page6_thumb.jpg" /></p>
<p>&nbsp;</p>
<p>jQuery allows us to take even further control of this, providing methods where you can define custom selectors of your own, or use powerful pseudo selectors such as : odd, :button, :submit or :reset to select elements you wish to style. What this means is that at the end of the day, you have access to (or the ability to create access to) any element in the DOM via any number of conditions you want it to satisfy.</p>
<p>&nbsp;</p>
<p><img title="page-7" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-7" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page7_thumb.jpg" /></p>
<p>&nbsp;</p>
<p><strong>Transparency</strong></p>
<p>&nbsp;</p>
<p>jQuery has also made Opacity (or Transparency) more easy to implement than ever. Opacity is an effect whereby you set the visibility of an element to be a percentage or fraction of what it originally was &ndash; in design, this is often used to show that an element is inactive or to allow you to see through it. In the past, it was necessary to code up a special Opacity case for IE8, IE5-7, Safari, Netscape and the list went on. It was frustrating for developers because even at their best, these custom cases didn&rsquo;t always work. That&rsquo;s where we bring in jQuery&hellip;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a><img title="page-2" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-2" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page2_thumb.jpg" /></a></p>
<p>&nbsp;</p>
<p>jQuery&rsquo;s support for transparency is so broad, that all you need to do to add opacity effects to any element in your page is use a selector for the element followed by .css(&ldquo;opacity&rdquo;, &ldquo;opacity-value&rdquo;); It really is that straight-forward.</p>
<p>&nbsp;</p>
<p><a><img title="page-3" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-3" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page3_thumb.jpg" /></a></p>
<p>&nbsp;</p>
<p><strong>Hover</strong></p>
<p>&nbsp;</p>
<p>Next, let&rsquo;s take a look at the hover class. I remember that years ago, you could probably get away with using the simple css :hover selector to add hover effects to an element, but you would always run into problems with older browsers not being able to use this correctly. Now before anyone leaps in and says.. Well.. nobody these days has an old browser, you might be right, but don&rsquo;t forget about that Mobile Web Browsers. Many of these browsers currently used in all sorts of Mobile devices don&rsquo;t fully support the entire CSS 1/2 specification, but using jQuery can provide us with access to the features of them than can make &lsquo;hover&rsquo; work as expected.</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page4.jpg"><img title="page-4" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-4" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page4_thumb.jpg" /></a></p>
<p>&nbsp;</p>
<p>With jQuery, all you need to do to add hover classes to any element on your page is define a function as follows $(selector).hover { function for mouseOver, function for mouseOut}. Your mouseOver function can easily attach a class that highlights the element or perhaps underlines it while your mouseOver event would remove this class taking the element back to it&rsquo;s default state. No more having to worry about IE not supporting the effect we&rsquo;re trying to achieve!</p>
<p>&nbsp;</p>
<p>&nbsp; <a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page5.jpg"><img title="page-5" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-5" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page5_thumb.jpg" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Animation</strong></p>
<p>&nbsp;</p>
<p>For anyone that&rsquo;s ever seen some of my CoverFlow work in JavaScript over the years, you&rsquo;ll know that it can sometimes take a while to create impressive effects using JavaScript if you&rsquo;re writing them from scratch. You don&rsquo;t have the Tweening tools available to you in many production quality animation systems and much of your work is going to be manual. You&rsquo;ve got to consider how the effect is going to look using your default CSS, whether it&rsquo;s going to slow your browser down to a halt when all your styling&rsquo;s done, if it&rsquo;ll work in all browsers but..jQuery takes a lot of that pain right away.</p>
<p>&nbsp;</p>
<p>With it&rsquo;s built-in functions like fadeIn(), slideDown() and more, it&rsquo;s never been easier to add simple animated effects to you webpages easily. jQuery even comes with a special animate() function that lets you chain together special effects so things that I would have had nightmares about (like having a logo from the top of a page, adding and removing CSS classes every second or two to create complex effects or even just making an icon bounce) are now relatively easy to get done in a few minutes.</p>
<p>&nbsp;</p>
<p><img title="page-17" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-17" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page17_thumb.jpg" /></p>
<p>&nbsp;</p>
<p>In this slide you can see an example of where jQuery can be truly powerful &ndash; we have a block of text in a paragraph which we need to constrain to a specific width so that it doesn&rsquo;t break our site&rsquo;s template. This piece of text could just be a list that would look better in it&rsquo;s original form rather than having a few line breaks split it up, so how can jQuery help me come up with a solution to my problem?.</p>
<p>&nbsp;</p>
<p>Well, let&rsquo;s use hover! &ndash; if I were to make it so that when someone hovers over the paragraph it&rsquo;ll set itself to the front of the page and expand, they&rsquo;ll be able to read it without breaking my template. Just as easily, when they mouseOut, I can simply set the width of the paragraph back to what it was before and my page will still work fine without any problems at all. A perfect example of how a nice UI update can be achieved with minimal code and the amazing jQuery framework.</p>
<p>&nbsp;</p>
<p><img title="page-18" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-18" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page18_thumb.jpg" /></p>
<p>&nbsp;</p>
<p><strong>Grids</strong></p>
<p>&nbsp;</p>
<p>Next lets take a look at Grids &ndash; Grids can contain all sorts of information from gallery thumbnails to previews of pieces of text from a document. A perfect example of the kind of content you might want to fit into the below layout is if you have a Blog or Publishing site where users are posting new articles or stories every day (even Tweets). You might want a way of showing readers a preview of content past just the title and what better way to display it in a compact form other than a grid?</p>
<p>&nbsp;</p>
<p>The problem with grids are that they can be difficult &ndash; when you&rsquo;re not dealing with tabular data and your content has text of a length that can vary, you need to think of an intelligent way to make your layout shape around the data so that it still looks the way you want it to.</p>
<p>&nbsp;</p>
<p><a><img title="page-8" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-8" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page8_thumb.jpg" /></a></p>
<p>&nbsp;</p>
<p>If we try to solve this problem using just CSS, it&rsquo;s going to take us hours because as you can see below, simply defining one class for our grid entry isn&rsquo;t going to solve our problem. We *could* do something on the server side such as limiting the amount of text that&rsquo;s output, but what if we wanted to let the user expand the entry so they can read all of the preview text or we wanted to display a complete sentence? A UI Solution would be called for and as CSS is going to cause us some problems, let&rsquo;s see if we can come up with something more intelligent using jQuery next..</p>
<p>&nbsp;</p>
<p><a><img title="page-9" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-9" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page9_thumb.jpg" /></a>&nbsp;</p>
<p>With jQuery, we can set specific CSS rules for border cases, text that makes our preview element longer than the other entries, we can turn our entire DIV into a clickable object and to top if off we can also add some nice opacity hover effects to make it look that extra bit professional. We can achieve all of these using a few simple checks for height, a few css rules and some basic jQuery functions. For the full code samples, please click on the slide to expand.</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page10.jpg"><img title="page-10" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-10" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page10_thumb.jpg" /></a>&nbsp;</p>
<p><strong>Zebra Striping</strong></p>
<p>&nbsp;</p>
<p>Zebra Striping is a design technique that will be familiar to anyone that&#8217;s ever used iTunes &#8211; it&#8217;s an aesthetically pleasing way of displaying your information because it allows the reader to neatly separate rows of data in their mind.</p>
<p>&nbsp;</p>
<p>The problem with Zebra striping is that it usually requires a lot of manual work, whether you decide to use the <img src='http://addyosmani.com/blog/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> dd and :even selectors or not. Stylesheets, whether they be on the web via CSS or in an application such as Adobe InDesign are there to control the visual properties of elements contained within a document. And while CSS&rsquo;s selectors allow you to specify which document elements should have which styles applied, the pure-CSS solution to Zebra Striping requires the author to apply the appropriate class (either even or odd) to at least half of the rows in a table.</p>
<p>&nbsp;</p>
<p>While this isn&rsquo;t a problem if the table contains only a few rows, copying and pasting can get old very quickly when the table contains tens or hundreds of rows. This problem can be avoided when the table is generated on the server side, because modifications to the table&rsquo;s markup need only the editing of a few lines of code. Unfortunately, not every web page is built by a server-side application, and even if you are creating a web app, it is frequently desirable to off-load layout processing to the client through CSS and JavaScript &#8211; so let&#8217;s see how jQuery can make Zebra striping easy for everyone.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page12.jpg"><img title="page-12" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-12" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page12_thumb.jpg" /></a>&nbsp;</p>
<p>Rather than tediously and manually binding CSS classes to the appropriate rows, we can instead use a little jQuery to go through the table and apply CSS styles for us.</p>
<p>&nbsp;</p>
<p>Let&rsquo;s take a look at how this can be achieved:</p>
<p>&nbsp;</p>
<p>1. Obtain a reference to the table that we want to add stripes to.    <br />
2. With that in hand, drill down into the table&rsquo;s child elements to find all the &lt;tr&gt;s that are contained within &lt;tbody&gt; elements.     <br />
3. Loop through the &lt;td&gt;s and apply the appropriate styling (which is determined by the location of this &lt;tr&gt; in the table).     <br />
Season to taste.</p>
<p>&nbsp;</p>
<p>A-List-Apart has an excellent demo of this that reproduces the <a href="http://www.alistapart.com/d/stripedtables/example.html">iTunes Zebra Striping Effect.</a> The source code to their script can be found <a href="http://www.alistapart.com/d/stripedtables/script.txt">here</a>. In the below example, Zebra Striping can be extended by adding hover classes for specific columns or rows.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a><img title="page-13" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-13" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page13_thumb.jpg" /></a>&nbsp;</p>
<p>We can take that example one step further by using a selector which checks to see if a particular row contains a specific term. This Client-side search doesn&rsquo;t need Ajax or any server-side code to work and within one line of jQuery we can easily find and highlight the row we&rsquo;re looking for.</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page14.jpg"><img title="page-14" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-14" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page14_thumb.jpg" /></a>&nbsp;</p>
<p>A plugin that I&rsquo;ve personally found useful in the past is the jQuery TableSorter by Christian Bach. It&rsquo;s very easy to integrate into both HTML, Adobe AIR and PHP Applications and even includes some really great Sorting options too. You can check it out over at <a href="http://www.tablesorter.com/docs">http://www.tablesorter.com/docs</a></p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page15.jpg"><img title="page-15" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-15" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page15_thumb.jpg" /></a>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Loading After Loading</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>One of the issues that users regularly experience is having to wait for their page to fully load up Flash Video Players &ndash; we&rsquo;ve all had to deal with this crap before. Some sites, rather than automatically loading up a video, will instead display a thumbnail or preview image in the Player to speed things up, but if you have to wait for Flash to initialize it&rsquo;s still going to take some of your time. jQuery allows us to do this a little more intelligently. Rather than loading up multimedia when the page first loads, just display the preview image in a div (without the Player loaded). If a user decided they want to watch the video, you can easily load up the Flash Video Player page via jQuery&rsquo;s .load() function so that if they would like to watch it..they will, but if they don&rsquo;t, they&rsquo;ll have a much faster and smoother experience browsing through the rest of your site.</p>
<p>&nbsp;</p>
<p>&nbsp; <a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page19.jpg"><img title="page-19" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-19" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page19_thumb.jpg" /></a>&nbsp;</p>
<p><strong>Controlling Outside Content</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>CSS is a wonderful tool for designing, but what if you want to control the content that you&rsquo;ve styled up outside of pure CSS definitions?. That&rsquo;s a problem&nbsp; &#8211; CSS doesn&rsquo;t allow you to dynamically display content when other actions occur in your page such as a user entering in their password or credit-card details. This is where some really simply jQuery logic can add more power to your interface.&nbsp; In the example below we want to display a voucher code box when a user clicks on &ldquo;Add a coupon&rdquo;. Because CSS doesn&rsquo;t allow us to do this..</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page20.jpg"><img title="page-20" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-20" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page20_thumb.jpg" /></a>&nbsp;</p>
<p>we simply do it with some JavaScript. Notice how in just two lines of code we&rsquo;ve managed to enrich our shopping cart in less than 30 seconds. How awesome is that?</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page21.jpg"><img title="page-21" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-21" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page21_thumb.jpg" /></a>&nbsp;</p>
<p>To sum it up, jQuery is a CSS fan&rsquo;s dream &ndash; it provides you with a simple, elegant way to add another level of interaction to your pages without having to waste your time debugging too many quirks with our age-old friend, JavaScript. On many occasions, it&rsquo;s helped me to pump out impressive interactive web-pages that not only impressed my clients&hellip;.. they impressed <em>me</em> too, because for many years it wasn&rsquo;t possible to do the things it&rsquo;s enabled us to without taking days. So as we welcome in the new year, I&rsquo;d like to take my hat off to jQuery &ndash; thank you for making my life easier. Once again, my thanks to Chris Coyier for his excellent presentation slides</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/page22.jpg"><img title="page-22" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="400" alt="page-22" width="526" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/page22_thumb.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/extending-css-with-jquery-a-new-years-guide/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>30 Hand-Picked Examples of Good Web Design</title>
		<link>http://addyosmani.com/blog/30-hand-picked-examples-of-good-web-design/</link>
		<comments>http://addyosmani.com/blog/30-hand-picked-examples-of-good-web-design/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 23:10:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[designs]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[graphic design inspiration]]></category>
		<category><![CDATA[graphic inspiration]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[hand-picked]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[layouts]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[sample web design]]></category>
		<category><![CDATA[selection]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web design examples]]></category>
		<category><![CDATA[web design inspiration]]></category>
		<category><![CDATA[web design inspiration gallery]]></category>
		<category><![CDATA[web designing]]></category>
		<category><![CDATA[web developing]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[web inspiration]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/30-hand-picked-examples-of-good-web-design/</guid>
		<description><![CDATA[&#160;

&#160;
In today&#8217;s post, I thought it might be nice to hand-pick some of my favourite sites for design inspiration. Many of these sites take web design to the next-level featuring unique graphics concepts, excellent typography and a clean layout that&#8217;s memorable. Learning from other designers is an excellent way for you to charge up your [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://addyosmani.com/blog/30-hand-picked-examples-of-good-web-design/" class="thickbox"><img width="530" height="342" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/graph__thumb.jpg" alt="graph_" style="border-width: 0px; display: inline;" title="graph_" /></a></p>
<p>&nbsp;</p>
<p>In today&rsquo;s post, I thought it might be nice to hand-pick some of my favourite sites for design<strong> inspiration</strong>. Many of these sites take web design to the next-level featuring unique graphics concepts, excellent typography and a clean layout that&rsquo;s memorable. Learning from other designers is an excellent way for you to charge up your creative batteries and I hope this post gives you a few ideas to help with your own projects!</p>
<p><span id="more-314"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.digitalmash.com">Hero for Hire</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.digitalmash.com" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/digitalmash.com.jpg" alt="digitalmash.com" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="digitalmash.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.four24.com">Four 24</a></strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.four24.com" class="thickbox"><img width="550" height="302" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/four24.com.jpg" alt="four24.com" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="four24.com" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.storenvy.com">Storenvy</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.storenvy.com"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/storenvy.com.jpg" alt="storenvy.com" style="border-width: 0px; display: inline;" title="storenvy.com" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.sitecake.com">SiteCake</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.sitecake.com"><img width="550" height="356" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/sitecake.com.jpg" alt="sitecake.com" style="border-width: 0px; display: inline;" title="sitecake.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.motionspire.com">MotionSpire</a></strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.motionspire.com" class="thickbox"><img width="550" height="296" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/motionspire.com.jpg" alt="motionspire.com" style="border-width: 0px; display: inline;" title="motionspire.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.quaffslabs.com">QuaffsLabs</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.quaffslabs.com" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/quaffslabs.com.jpg" alt="quaffslabs.com" style="border-width: 0px; display: inline;" title="quaffslabs.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.newworkcity.com.au">NewWorkCity</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.newworkcity.com.au" class="thickbox"><img width="550" height="300" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/newworkcity.com.au.jpg" alt="newworkcity.com.au" style="border-width: 0px; display: inline;" title="newworkcity.com.au" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.radiumlabs.com">RadiumLabs</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.radiumlabs.com"><img width="550" height="303" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/radiumlabs.com.jpg" alt="radiumlabs.com" style="border-width: 0px; display: inline;" title="radiumlabs.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.elmwood.com">Elmwood Design</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.elmwood.com"><img width="550" height="300" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/elmwood.com.jpg" alt="elmwood.com" style="border-width: 0px; display: inline;" title="elmwood.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.asosplc.com">ASOS Plc</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.asosplc.com"><img width="550" height="376" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/asosplc.com.jpg" alt="asosplc.com" style="border-width: 0px; display: inline;" title="asosplc.com" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.davidmassiani.com/">David Massiani</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.davidmassiani.com/"><img width="550" height="300" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/davidmassiani.com.jpg" alt="davidmassiani.com" style="border-width: 0px; display: inline;" title="davidmassiani.com" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.nameourbaby.ca">NameOurBaby</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.nameourbaby.ca"><img width="550" height="307" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/nameourbaby.ca.jpg" alt="nameourbaby.ca" style="border-width: 0px; display: inline;" title="nameourbaby.ca" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.silverbackapp.com">SilverBackApp</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.silverbackapp.com"><img width="550" height="303" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/silverbackapp.com.jpg" alt="silverbackapp.com" style="border-width: 0px; display: inline;" title="silverbackapp.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.getmefast.com">GetMeFast</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.getmefast.com"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/getmefast.com.jpg" alt="getmefast.com" style="border-width: 0px; display: inline;" title="getmefast.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.riotindustries.com">Riot Industries</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.riotindustries.com" class="thickbox"><img width="550" height="292" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/riotindustries.com.jpg" alt="riotindustries.com" style="border-width: 0px; display: inline;" title="riotindustries.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.peepnote.com">PeepNote</a></strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.peepnote.com"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/peepnote.com.jpg" alt="peepnote.com" style="border-width: 0px; display: inline;" title="peepnote.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.playintraffik.com">Traffik</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.playintraffik.com" class="thickbox"><img width="550" height="307" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/playintraffik.com.jpg" alt="playintraffik.com" style="border-width: 0px; display: inline;" title="playintraffik.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.spinen.com">Spinen</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.spinen.com"><img width="550" height="298" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/spinen.com.jpg" alt="spinen.com" style="border-width: 0px; display: inline;" title="spinen.com" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.narfstuff.co.uk/portfolio/">NarfStuff Portfolio</a></p>
<p>&nbsp;</p>
<p><a href="http://www.narfstuff.co.uk/portfolio/" class="thickbox"><img width="550" height="314" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/franboot.jpg" alt="franboot" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="franboot" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.hyperxlocal.com">HyperXLocal</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.hyperxlocal.com" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/hyperxlocal.com.jpg" alt="hyperxlocal.com" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="hyperxlocal.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.creative-outsourcing.com/index-en.html">Creative Outsourcing</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.creative-outsourcing.com/index-en.html"><img width="550" height="303" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/creativeoutsourcing.com.jpg" alt="creative-outsourcing.com" style="border-width: 0px; display: inline;" title="creative-outsourcing.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.howhost.com/en/">HowHost</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.howhost.com/en/" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/howhost.com.jpg" alt="howhost.com" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="howhost.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.yazsoft.com">YazSoft</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.yazsoft.com" class="thickbox"><img width="550" height="300" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/yazsoft.com.jpg" alt="yazsoft.com" style="border-width: 0px; display: inline;" title="yazsoft.com" /></a>&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><a href="http://www.serj.ca">Serj.ca</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.serj.ca" class="thickbox"><img width="550" height="303" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/serj.ca.jpg" alt="serj.ca" style="border-width: 0px; display: inline;" title="serj.ca" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.sourcebits.com/nerve/">Nerve Music</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.sourcebits.com/nerve/" class="thickbox"><img width="550" height="307" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/nerve.jpg" alt="nerve" style="border-width: 0px; display: inline;" title="nerve" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.macheist.com/tweetblast/">Voices</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.macheist.com/tweetblast/" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/macheist.com.jpg" alt="macheist.com" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="macheist.com" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.tearoundapp.com">TeaRound</a></strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.tearoundapp.com" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/tearound.jpg" alt="tearound" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="tearound" /></a>&nbsp;</p>
<p><strong><a href="http://365daysofastronomy.org/">365 Days of Astronomy</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://365daysofastronomy.org/" class="thickbox"><img width="550" height="307" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/365days.jpg" alt="365days" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="365days" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.blogfullbliss.com/portfolio">BlogFullBliss</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.blogfullbliss.com/portfolio" class="thickbox"><img width="550" height="305" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/bliss.jpg" alt="bliss" style="border-width: 0px; display: inline;" title="bliss" /></a></p>
<p>&nbsp;</p>
<p><strong><a href="http://www.villagerkent.com/">Villager-Kent</a></strong></p>
<p>&nbsp;</p>
<p><a href="http://www.villagerkent.com/" class="thickbox"><img width="550" height="303" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/villager.jpg" alt="villager" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="villager" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/30-hand-picked-examples-of-good-web-design/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>How to create impressive animations using Webkit CSS and JavaScript</title>
		<link>http://addyosmani.com/blog/how-to-create-impressive-animations-using-webkit-css-and-javascript/</link>
		<comments>http://addyosmani.com/blog/how-to-create-impressive-animations-using-webkit-css-and-javascript/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 01:53:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[animations]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript animation]]></category>
		<category><![CDATA[transforms]]></category>
		<category><![CDATA[webkit]]></category>
		<category><![CDATA[webkit animation]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/how-to-create-impressive-animations-using-webkit-css-and-javascript/</guid>
		<description><![CDATA[
 
&#160;
Hey all. In today’s post I’m going to show you how to create a few simple yet impressive animation effects using WebKit CSS and some JavaScript. Webkit (the rendering engine that powers both Safari and Google Chrome) supports a few advanced animation features which have yet to make their way into FireFox or IE, [...]]]></description>
			<content:encoded><![CDATA[<p><strong></strong></p>
<p><img title="webs" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="295" alt="webs" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/webs.jpg" width="508" border="0" /> </p>
<p>&#160;</p>
<p>Hey all. In today’s post I’m going to show you how to create a few simple yet impressive animation effects using WebKit CSS and some JavaScript. Webkit (the rendering engine that powers both Safari and Google Chrome) supports a few advanced animation features which have yet to make their way into FireFox or IE, but it’s really exciting getting to see just what’s capable with it animation-wise. For anyone that enjoyed reading my <a href="http://addyosmani.com/blog/an-amazing-jquery-3d-wall-for-webkit-youtube-edition/">3D Wall</a> post, this is going to be a treat.</p>
<p><span id="more-281"></span>
<p>&#160;</p>
<p>WebKit animation is especially of interest given that it’s a lot easier to create powerful animations in it using just CSS than with any other browser. It’s also really interesting because Mozilla are pondering switching over to them as their rendering engine of choice. Many of the Webkit-specific animation effects in today’s post can be rendered successfully using either jQuery or plain-JavaScript, but for the sake of simplicity today’s post is going to use the latter.</p>
<p>&#160;</p>
<p><strong>Quick note:</strong> The demos in this article are going to use WebKit for all of the rendering. If you are currently using FireFox or IE and would prefer not to install another browser, <a href="http://www.addyosmani.com/resources/webkit/WebKitLite.zip">here’s</a> a light, portable version of WebKit that I’ve put together than you can download for testing WebKit related projects easily. It’s only around 10mb in size and has been tested with both our demos for today, so feel free to grab it if you need it.</p>
<p>&#160;<a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/image.png"><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="75" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image_thumb.png" width="508" border="0" /></a> </p>
<p>&#160;</p>
<p>To get started with Webkit animation, let’s take a look at a very simple example of a bounce effect. </p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/image1.png"><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="109" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image_thumb1.png" width="447" border="0" /></a> </p>
<p>&#160;</p>
<p>A Bounce effect is a relatively easy effect to achieve as all that’s required to get it working is an object, the two points you want to bounce that object between and the code to do the bounce itself. In Webkit, the first thing we do to create a bounce effect is define the range points as follows:</p>
<p>&#160;</p>
<p>&#160;<font face="Courier New" color="#804000" size="2"> @-webkit-keyframes bounce {&#160; from {&#160;&#160;&#160; left: 0px;&#160; }&#160; to {&#160;&#160;&#160; left: 200px;&#160; } }&#160;&#160; </font></p>
<p>&#160;</p>
<p>Next, we use a Webkit Keyframes block which defines the styles for the animation and the duration for which the animation lasts:</p>
<p>&#160;</p>
<p><font face="Courier New" color="#804000" size="2">&#160; div {&#160; </font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-name: bounce;&#160; </font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-duration: 4s;&#160; </font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-iteration-count: 10;&#160; </font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-direction: alternate; </font></p>
<p><font face="Courier New" color="#804000" size="2">}</font>&#160;&#160; </p>
<p>&#160;</p>
<p>The final product we get looks like <a href="http://webkit.org/blog-files/bounce.html">this</a>. Next, let’s do something a little more advanced using JavaScript.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="75" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image2.png" width="508" border="0" /> </p>
<p>&#160;</p>
<p>In the example below (see <a href="http://webkit.org/blog-files/leaves/index.html">demo here</a> in Chrome or Safari) you can see a selection of leaves falling down a window which look pretty slick. Even though the entire effect is achieved using JavaScript, it still looks just as good as if it were created using Flash.</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://webkit.org/blog-files/leaves/index.html"><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="287" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image3.png" width="509" border="0" /></a> </p>
<p>&#160;</p>
<p>The effect itself is initialized by creating a loop for the number of leaves you want to generate and then calling the createLeaf() function as follows:</p>
<p>&#160;</p>
<p>The initialization step:</p>
<p>&#160;</p>
<pre><font color="#804000">function init()
{
    /* Get a reference to the element that will contain the leaves */
    var container = document.getElementById('leafContainer');
    /* Fill the empty container with new leaves */
    for (var i = 0; i &lt; NUMBER_OF_LEAVES; i++)
    {
        container.appendChild(createALeaf());
    }
}</font></pre>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/image4.png"><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="207" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image_thumb2.png" width="498" border="0" /></a> </p>
<p>&#160;</p>
<p>Next, let’s define a function to generate a random number between two ranges for our leaf positioning:</p>
<p>&#160;</p>
<pre><font color="#804000">//Receives the lowest and highest values of a range and returns a random </font></pre>
<pre><font color="#804000">//integer that falls within that range.
function randomInteger(low, high)
{
    return low + Math.floor(Math.random() * (high - low));
}</font></pre>
<p>And finally the step to create a new leaf:</p>
<p>&#160;</p>
<pre><font color="#804000">function createALeaf()
{
    <strong>/* Start by creating a wrapper div, and an empty img element */</strong>
    var leafDiv = document.createElement('div');
    var image = document.createElement('img');

    <strong>/* Randomly choose a leaf image and assign it to the newly created element */</strong>
    image.src = 'images/realLeaf' + randomInteger(1, 5) + '.png';

    leafDiv.style.top = &quot;-100px&quot;;

    <strong>/* Position the leaf at a random location along the screen */</strong>
    leafDiv.style.left = pixelValue(randomInteger(0, 500));

    <strong>/* Randomly choose a spin animation */</strong>
    var spinAnimationName = (Math.random() &lt; 0.5) ? 'clockwiseSpin' : </font></pre>
<pre><font color="#804000">'counterclockwiseSpinAndFlip';

    <strong>/* Set the -webkit-animation-name property with these values */</strong>
    leafDiv.style.webkitAnimationName = 'fade, drop';
    image.style.webkitAnimationName = spinAnimationName;

    <strong>/* Figure out a random duration for the fade and drop animations */</strong>
    var fadeAndDropDuration = durationValue(randomFloat(5, 11));

   <strong> /* Figure out another random duration for the spin animation */</strong>
    var spinDuration = durationValue(randomFloat(4, 8));
    /* Set the -webkit-animation-duration property with these values */
    leafDiv.style.webkitAnimationDuration = fadeAndDropDuration + ', ' + </font></pre>
<pre><font color="#804000">fadeAndDropDuration;

    var leafDelay = durationValue(randomFloat(0, 5));
    leafDiv.style.webkitAnimationDelay = leafDelay + ', ' + leafDelay;

    image.style.webkitAnimationDuration = spinDuration;

    <strong>// add the &lt;img&gt; to the &lt;div&gt;</strong>
    leafDiv.appendChild(image);

    <strong>/* Return this img element so it can be added to the document */</strong>
    return leafDiv;
}</font></pre>
</p>
<p>&#160;</p>
<p>and that’s it!. Here’s the <a href="http://webkit.org/blog-files/leaves/index.html">final</a> product.</p>
<p>&#160;</p>
<p><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="75" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image5.png" width="508" border="0" /> </p>
<p>&#160;</p>
<p>It’s also possible to create Webkit animation effects <strong>without</strong> needing to use any JavaScript at all. You may not have as much control over the effects, but you can still make something that’s equally as effective. Let’s take a look at the <a href="http://girliemac.com/sandbox/snow.html">Snow-flake effect.</a></p>
<p>&#160;</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://girliemac.com/sandbox/snow.html"><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="369" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image6.png" width="461" border="0" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<p>To create this, first let’s define some structure for our snow-flakes and the tree in the backdrop.</p>
<p>&#160;</p>
<p><font face="Courier New" color="#804000" size="2">&lt;div id=&quot;container&quot;&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;div id=&quot;snow&quot; class=&quot;snow&quot;&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;!&#8211; Draw snowflakes without using images! &#8211;&gt; </font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;div class=&quot;snowflake f1&quot;&gt;&amp;#10053;&lt;/div&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;div class=&quot;snowflake f2&quot;&gt;&amp;#10052;&lt;/div&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;div class=&quot;snowflake f3&quot;&gt;&amp;#10053;&lt;/div&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;div class=&quot;snowflake f4&quot;&gt;&amp;#10052;&lt;/div&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;/div&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;div id=&quot;ground&quot;&gt;&lt;/div&gt;</font></p>
<p><font face="Courier New" color="#804000" size="2">&lt;/div&gt;</font></p>
</p>
<p>&#160;</p>
<p>Next, let’s define the WebKit CSS for the animation effects. These include a fade effect, spin effect and fall effects. The best part about animation in WebKit is that you can easily define powerful effects using simple commands such as from –&gt; to (see fall below). It’s also really simple to add fade effects using just the opacity parameter (see fade).</p>
<p>&#160;</p>
<p><font face="Courier New" color="#804000" size="2">@-webkit-keyframes fade{</font></p>
<p><font face="Courier New" color="#804000" size="2">0% { opacity: 0; }</font></p>
<p><font face="Courier New" color="#804000" size="2">10% { opacity: 0.8; }</font></p>
<p><font face="Courier New" color="#804000" size="2">100% { opacity: 0; }</font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p><font face="Courier New" color="#804000" size="2">@-webkit-keyframes fall{</font></p>
<p><font face="Courier New" color="#804000" size="2">from {top: 10px;}</font></p>
<p><font face="Courier New" color="#804000" size="2">to {top: 470px;}</font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p><font face="Courier New" color="#804000" size="2">@-webkit-keyframes accumulate{</font></p>
<p><font face="Courier New" color="#804000" size="2">from {height: 0px; opacity: 0}</font></p>
<p><font face="Courier New" color="#804000" size="2">to {height: 20px; opacity: .75;}</font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p>&#160;</p>
<p>The spin effect is created by defining a Webkit rotate transformation at a given angle as follows:</p>
<p>&#160;</p>
<p><font face="Courier New" color="#804000" size="2">@-webkit-keyframes spin{</font></p>
<p><font face="Courier New" color="#804000" size="2">0% { -webkit-transform: rotate(-180deg) translate(0px, 0px);}</font></p>
<p><font face="Courier New" color="#804000" size="2">100% { -webkit-transform: rotate(180deg) translate(10px, 75px);}</font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p><font face="Courier New" color="#804000" size="2"></font></p>
<p>&#160;</p>
<p>Next, we define an animation length for each of the snowflakes as well as initial positioning details as follows:</p>
<p>&#160;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/12/image7.png"><img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="230" alt="image" src="http://addyosmani.com/blog/wp-content/uploads/2009/12/image_thumb3.png" width="389" border="0" /></a> </p>
<p>&#160;</p>
<p><font face="Courier New" color="#804000" size="2">.snowflake.f1 {</font></p>
<p><font face="Courier New" color="#804000" size="2">left: 40px;</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-duration: 5s; </font></p>
<p><font face="Courier New" color="#804000" size="2">/* set duration individually */</font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p><font face="Courier New" color="#804000" size="2">.snowflake.f2 {</font></p>
<p><font face="Courier New" color="#804000" size="2">font-size: 1.8em;</font></p>
<p><font face="Courier New" color="#804000" size="2">left: 120px;</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-duration: 7s; </font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p><font face="Courier New" color="#804000" size="2">.snowflake.f3 {</font></p>
<p><font face="Courier New" color="#804000" size="2">left: 200px;</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-duration: 8s; </font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p><font face="Courier New" color="#804000" size="2">.snowflake.f4 {</font></p>
<p><font face="Courier New" color="#804000" size="2">font-size: 1.5em;</font></p>
<p><font face="Courier New" color="#804000" size="2">left: 280px;</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-duration: 6s; </font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p>&#160;</p>
<p>Finally, we setup the animation by telling Webkit what effects we want to use, the iteration behaviour for the animation and finally the direction we wish our effects to take. </p>
<p>&#160;</p>
<p><font face="Courier New" color="#804000" size="2">#snow div {</font></p>
<p><font face="Courier New" color="#804000" size="2">position: absolute;</font></p>
<p><font face="Courier New" color="#804000" size="2">top: -40px;</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-name: fall, fade, spin;</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-iteration-count: infinite; /* use 0 to infinite */</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-direction: normal; /* default is normal. use &#8216;alternate&#8217; to reverse direction */</font></p>
<p><font face="Courier New" color="#804000" size="2">-webkit-animation-timing-function: ease-in;</font></p>
<p><font face="Courier New" color="#804000" size="2">}</font></p>
<p>&#160;</p>
<p>&#160;</p>
<p>WebKit transforms and Webkit animation are an amazing step-forward in the progress towards in-browser, flash-less animation and this is definitely an area to watch for the future. I hope this article has given you all a little inspiration for your projects – feel free to let me know what you think in the comments!. Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/how-to-create-impressive-animations-using-webkit-css-and-javascript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>20 Amazing jQuery Plugins to improve your User Interface</title>
		<link>http://addyosmani.com/blog/20-amazing-jquery-plugins-to-improve-your-user-interface/</link>
		<comments>http://addyosmani.com/blog/20-amazing-jquery-plugins-to-improve-your-user-interface/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 05:30:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[bubble]]></category>
		<category><![CDATA[dance]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[speech]]></category>
		<category><![CDATA[tooltip]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[widgets]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/20-amazing-jquery-plugins-to-improve-your-user-interface/</guid>
		<description><![CDATA[&#160;
&#160;
In today&#8217;s post I&#8217;m going to share 20 jQuery Plugins that I think could really improve your user interface in just a few minutes. Some of them require a little more customization or integration than others, but on the whole, the plugins in this post will hopefully give you the inspiration and implementations you need [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;<img width="500" height="302" alt="" src="http://addyosmani.com/blog/wp-content/uploads/jq20.jpg" /></p>
<p>&nbsp;</p>
<p>In today&rsquo;s post I&rsquo;m going to share 20 jQuery Plugins that I think could really improve your user interface in just a few minutes. Some of them require a little more customization or integration than others, but on the whole, the plugins in this post will hopefully give you the inspiration and implementations you need to give your projects that little extra something.</p>
<p>&nbsp;</p>
<p><span id="more-249"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=db674f1c92a532702569c3627c592aa1&amp;url=http://s1.jqueryplugins.com/pluginimages/271.jpg&amp;w=90&amp;h=90" /></p>
<p><a href="http://www.jqueryplugins.com/plugin/271/">jQuery Plugin &#8211; Feature List</a></p>
<p>Simple and easy creation of an interactive &quot;Featured Items&quot; widget &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=571e68da3b39df5d795f4a2170e79f66&amp;url=http://s1.jqueryplugins.com/pluginimages/193.jpg&amp;w=90&amp;h=90" /></p>
<p><a href="http://www.jqueryplugins.com/plugin/193/">jQuery Plugin &#8211; Sexy Alert Box</a></p>
<p>Sexy Alert Box is a &ldquo;sexy&rdquo; clone of classic Javascript alert &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=35bb6c8b0f6d22ed3af56717efc66f9c&amp;url=http://s1.jqueryplugins.com/pluginimages/295.jpg&amp;w=90&amp;h=90" /></p>
<p><a href="http://www.jqueryplugins.com/plugin/295/">jQuery Plugin &#8211; Facebook like Autosuggestion</a></p>
<p>Facebook like Autosuggestion user search with jQuery, Ajax and PHP &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=40dd3c8a81ced2fb32a998155c6e279b&amp;url=http://s2.jqueryplugins.com/pluginimages/274.jpg&amp;w=90&amp;h=90" /></p>
<p><a href="http://www.jqueryplugins.com/plugin/274/">jQuery Plugin &#8211; Horizontal Tooltips Menu</a></p>
<p>A horizontal menu with tooltip that slides across the menu panel &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=3d63e4fa01ac920b0a81769739191c21&amp;url=http://s2.jqueryplugins.com/pluginimages/268.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/268/">jQuery Plugin &#8211; Sexy Lightbox</a></p>
<p>Sexy Lightbox is a more lightweight and sexier clone of the classic Lightbox. It was constructed thinking about web designers, easy installation and use &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=4be4c144a822e738737db8bda8e1dc12&amp;url=http://s1.jqueryplugins.com/pluginimages/215.jpg&amp;w=90&amp;h=90" /></p>
<p><a href="http://www.jqueryplugins.com/plugin/215/">jQuery Plugin &#8211; Simple Page Peel Effect</a></p>
<p>You have probably seen these forms of advertisings where you can peel a corner of a website and see a message underneath &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=19a8ff5b3fe9839dfab476f1f7478090&amp;url=http://s1.jqueryplugins.com/pluginimages/205.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/205/">jQuery Plugin &#8211; Uploadify</a></p>
<p>Uploadify is a jQuery plugin that allows the easy integration of a multiple (or single) file uploads on your website &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=eb9bb90ed2a1be9b0985ea80c899700c&amp;url=http://s2.jqueryplugins.com/pluginimages/294.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/294/">jQuery Plugin &#8211; Facebook Style Alert Confirm Box</a></p>
<p>This shows you how to implement a facebook style alert box &#8230;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=06597ad7f8656a75aad04e19e2baa9c1&amp;url=http://s1.jqueryplugins.com/pluginimages/247.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/247/">jQuery Plugin &#8211; Create an Interactive, Filterable Portfolio</a></p>
<p>How to create an interactive portfolio in jQuery that looks like it was made in Flash &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=747a27a633c77b87f81ad4d6de8feadb&amp;url=http://s1.jqueryplugins.com/pluginimages/293.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/293/">jQuery Plugin &#8211; Favorite Rating</a></p>
<p>This tutorial shows you how to implement a &quot;Show the love&quot; rating system like amypink.com &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=d78ddd700161b0273ac6c0c0a6207b89&amp;url=http://s1.jqueryplugins.com/pluginimages/291.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/291/">jQuery Plugin &#8211; Coda Bubble</a></p>
<p>This plugin can be used to create multiple pop-ups Coda Bubble style &#8230;</p>
<p><img alt="" src="http://static.ak.fbcdn.net/rsrc.php/z12E0/hash/8q2anwu7.gif" />&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=91525278c0d658315d54ddc7ac3020a8&amp;url=http://s2.jqueryplugins.com/pluginimages/288.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/288/">jQuery Plugin &#8211; Search &amp; Share</a></p>
<p>Search and Share makes highlighting text a more functional action. More specifically, it attempts to understand the intention of a user&rsquo;s text selection and present a variety of options accordingly &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=dfb70061ec108cc6792569f7581635e5&amp;url=http://s1.jqueryplugins.com/pluginimages/287.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/287/">jQuery Plugin &#8211; Simply Scroll</a></p>
<p>simplyScroll is a jQuery plugin that can animate (scroll) a set of elements either automatically or manually, horizontally or vertically &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=c328c9cb4646d8dba0825e0c8b64107f&amp;url=http://s2.jqueryplugins.com/pluginimages/218.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/218/">jQuery Plugin &#8211; Side Navigation Tooltip / Popup Bubble</a></p>
<p>A tooltip / popup bubble using jQuery &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=f369790efecc83f2df5f9f6fff3385a6&amp;url=http://s1.jqueryplugins.com/pluginimages/283.jpg&amp;w=90&amp;h=90" /></p>
<p><a href="http://www.jqueryplugins.com/plugin/283/">jQuery Plugin &#8211; Color Changing Text and Backgrounds</a></p>
<p>Here&rsquo;s a quick and easy way to cycle between multiple colors smoothly. Normally you would define the (background) color in the CSS and that would be the end of it. In this case we want to be able to adjust colors &#8230;</p>
<p>&nbsp;&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=206242fd67503a9724ef0d8dbbc5c139&amp;url=http://s1.jqueryplugins.com/pluginimages/189.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/189/">jQuery Plugin &#8211; Dance Floor</a></p>
<p>When you click on a product, the product image will zoom out to see a featured close-up shot and a description &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=81a956a3a93bc0681e9ce959fd381bfc&amp;url=http://s1.jqueryplugins.com/pluginimages/239.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/239/">jQuery Plugin &#8211; Horizontal Animated Menu</a></p>
<p>This tutorial teaches you how to build a basic horizontal animated menu using jQuery that shows more information about the link when mouse is moved over it &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=cd95d89c7558364634914ac8b0dae00d&amp;url=http://s2.jqueryplugins.com/pluginimages/254.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/254/">jQuery Plugin &#8211; Editable Select</a></p>
<p>Transforms a select list to a text input so you can edit the value directly, or choose a value from the list options &#8230;</p>
<p>&nbsp;</p>
<p><img alt="" src="http://external.ak.fbcdn.net/safe_image.php?d=578a8152a8d943e68a48c6b49fef37af&amp;url=http://s2.jqueryplugins.com/pluginimages/282.jpg&amp;w=90&amp;h=90" /></p>
<p>&nbsp;<a href="http://www.jqueryplugins.com/plugin/282/">jQuery Plugin &#8211; Create Good Looking Floating Menu</a></p>
<p>This tutorial will show you how to create a horizontal menu with floating effect by using jquery.easing and jquery animate function &#8230;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/20-amazing-jquery-plugins-to-improve-your-user-interface/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Zoomer Gallery &#8211; A jQuery plugin for displaying images with Flash-like zooming effects</title>
		<link>http://addyosmani.com/blog/zoomer-gallery-a-jquery-plugin-for-displaying-images-with-flash-like-zooming-effects/</link>
		<comments>http://addyosmani.com/blog/zoomer-gallery-a-jquery-plugin-for-displaying-images-with-flash-like-zooming-effects/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:27:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[animated effects]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[animation effects]]></category>
		<category><![CDATA[bicubic]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash like]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image effects]]></category>
		<category><![CDATA[image gallery]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery animated gallery]]></category>
		<category><![CDATA[jquery animated images]]></category>
		<category><![CDATA[jquery animation effects]]></category>
		<category><![CDATA[jquery animation images]]></category>
		<category><![CDATA[jquery image zooming]]></category>
		<category><![CDATA[jquery list gallery]]></category>
		<category><![CDATA[jquery zoom images]]></category>
		<category><![CDATA[jquery zooming images]]></category>
		<category><![CDATA[lists]]></category>
		<category><![CDATA[tweening]]></category>
		<category><![CDATA[zoom]]></category>
		<category><![CDATA[zooming]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/zoomer-gallery-a-jquery-plugin-for-displaying-images-with-flash-like-zooming-effects/</guid>
		<description><![CDATA[&#160;
&#160;
&#160;
&#160;
In today&#8217;s post, I&#8217;m going to be giving away a new plugin for jQuery that allows you to easily transform your image lists into beautiful galleries with Flash-like zoom effects in them. It&#8217;s a simple but elegant way of giving your interfaces a nice little shine and at only 2KB in size, it&#8217;s both compact [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;<a href="http://addyosmani.com/blog/wp-content/uploads/2009/11/image.png" class="thickbox"><img width="504" height="352" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/image_thumb.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>In today&rsquo;s post, I&rsquo;m going to be giving away a <a href="http://addyosmani.com/resources/zoomer/zoomer.html">new plugin</a> for jQuery that allows you to easily transform your image lists into beautiful galleries with Flash-like zoom effects in them. It&rsquo;s a simple but elegant way of giving your interfaces a nice little shine and at only 2KB in size, it&rsquo;s both compact and surprisingly easy to use.</p>
<p><span id="more-241"></span><br />
<center></p>
<p><img border="0" name="demobuttons" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/image_thumb1.png" id="demobuttons" usemap="#m_demo20buttons" alt="" /><br />
<map name="m_demo20buttons" id="m_demo20buttons">
<area shape="rect" coords="258,16,515,99" href="http://www.addyosmani.com/resources/zoomer/zoomer.html" title="Demo" alt="Demo" />
<area shape="rect" coords="0,15,258,100" href="http://www.addyosmani.com/resources/zoomer/zoomer.for.jquery-1.0.zip" alt="" /> </map>
</p>
<p></center></p>
<p>&nbsp;</p>
<p><strong><font size="5"><font size="4">The background-story</font> </font></strong></p>
<p>&nbsp;</p>
<p>A while back, I used to work for an Image-Search company developing Flash image browsers for the company&rsquo;s Front-end. One of the reasons we had decided to opt for Flash back then was simple &ndash; we wanted to provide our clients with some eye-candy that could both demonstrate our technology working and our knowledge of smart user interfaces. Being fluent in both JavaScript frameworks and AS3, I knew how to code up the UI in either language, but because the quality of such effects wasn&rsquo;t up to par in JavaScript back then, we had to go for Flash.</p>
<p>&nbsp;</p>
<p>With jQuery&rsquo;s optimization of animation in javascript over the past few years, it&rsquo;s finally possible for us to create Flash-like interfaces using just JavaScript. So, I thought it would be nice to demonstrate a jQuery plugin that will allow you to achieve the same effects we used to use without needing any Flash at all. Let&rsquo;s see how it works!.</p>
<p>&nbsp;</p>
<p><strong><font size="4">Let&rsquo;s take a look at the code</font></strong></p>
<p>&nbsp;</p>
<p><img width="461" height="239" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/image1.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></p>
<p>&nbsp;</p>
<p>Impressive animation effects can be achieved in jQuery with just a few short lines of code and this plugin is no different. What we want to achieve today is increasing the visible size of a thumbnail image from something smaller to something larger whilst also animating the title/caption of it. Rather than using multiple images for this process, what we are going to do in this post is use the same image for both the thumbnail and the &ldquo;zoom&rdquo;. To do this we need to ensure that all of our images are larger than the default size of our thumbnails (and optimally, a little larger than our zoomed in images). CSS Bi-cubic interpolation is used to keep everything looking clean.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Lets define some plugin variables with the head of our new code</strong></p>
<p>&nbsp;</p>
<p><font color="#804000">$.fn.Zoomer=function(b){ </font></p>
<p><font color="#804000">var c=$.extend({</font></p>
<p><font color="#804000">speedView:200,&nbsp;&nbsp;&nbsp; </font><font color="#008000">//The speed of the main animation</font></p>
<p><font color="#804000">speedRemove:400,&nbsp; </font><font color="#008000">//The speed at which we remove the main animation</font></p>
<p><font color="#804000">altAnim:false,&nbsp; </font><font color="#008000">//Whether we animate our alt tags or not</font></p>
<p><font color="#804000">speedTitle:400, </font><font color="#008000">//The speed of our title animation</font></p>
<p><font color="#804000">debug:false},b);&nbsp; </font><font color="#008000">//A quick switch between debug mode</font></p>
<p><font color="#804000">var d=$.extend(c,b);</font></p>
<p>&nbsp;</p>
<p><strong>Now lets add two CSS classes for our code: The first is the default view for a thumbnail and the second is a class we attach to a thumbnail when someone hovers over it</strong></p>
<p>&nbsp;</p>
<p><font color="#804000">ul.thumb li img {</font></p>
<p><font color="#804000">width: 100px; </font></p>
<p><font color="#804000">height: 100px;</font></p>
<p><font color="#804000">border: 1px solid #ddd;</font></p>
<p><font color="#804000">padding: 5px;</font></p>
<p><font color="#804000">background: #f0f0f0;</font></p>
<p><font color="#804000">position: absolute;left: 0; top: 0;</font></p>
<p><font color="#804000">-ms-interpolation-mode: bicubic; </font></p>
<p><font color="#804000">}</font></p>
<p>&nbsp;</p>
<p><font color="#804000">ul.thumb li img.hover </font></p>
<p><font color="#804000">{</font></p>
<p><font color="#804000">margin-top:15px;</font></p>
<p><font color="#804000">background:url(thumb_bg.png) no-repeat center center;</font></p>
<p><font color="#804000">border: none;</font></p>
<p><font color="#804000">}</font></p>
<p>&nbsp;</p>
<p><strong>Next, lets take a look at the code required to animate the image from it&rsquo;s default size of 100px X 100px to a larger size.</strong><strong><br />
</strong></p>
<p>&nbsp;</p>
<p><strong><img width="452" height="199" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/image2.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></strong></p>
<p>&nbsp;</p>
<p><strong>Whilst we change over from our default class to the hover class, the effect we see will be a &ldquo;grow&rdquo; with the final state including a nice glowing border to it which is achieved using an image from the hover class above.</strong></p>
<p>&nbsp;</p>
<p><font color="#804000">$(this).find(&#8217;img&#8217;).addClass(&quot;hover&quot;).stop().animate(</font></p>
<p><font color="#804000">{marginTop:&#8217;-110px&#8217;,</font></p>
<p><font color="#804000">marginLeft:&#8217;110px&#8217;,</font></p>
<p><font color="#804000">top:&#8217;50%&#8217;,</font></p>
<p><font color="#804000">left:&#8217;50%&#8217;,</font></p>
<p><font color="#804000">width:&#8217;175px&#8217;,</font></p>
<p><font color="#804000">height:&#8217;181px&#8217;,</font></p>
<p><font color="#804000">padding:&#8217;20px&#8217;},d.speedView);</font></p>
<p>&nbsp;</p>
<p><img width="458" height="152" border="0" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/image3.png" alt="image" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" /></p>
<p>&nbsp;</p>
<p><strong>To make the effect look even better we want to animate the swinging in of our Title for the thumbnail. This is achieved as follows.</strong></p>
<p>&nbsp;</p>
<p><font color="#804000">$(&#8217;.title&#8217;).animate({</font></p>
<p><font color="#804000">marginLeft:&#8217;-42px&#8217;,</font></p>
<p><font color="#804000">marginTop:&#8217;90px&#8217;},</font></p>
<p><font color="#804000">d.speedTitle).css({&#8217;z-index&#8217;:'10&#8242;,&#8217;position&#8217;:'absolute&#8217;,'float&#8217;:'left&#8217;})}}}</font></p>
<p>&nbsp;</p>
<p><strong>We will also need to write some code to remove the effect elegantly when a user is no longer hovering over the current element. </strong></p>
<p>&nbsp;</p>
<p><font color="#804000">$(this).find(&#8217;img&#8217;).removeClass(&quot;hover&quot;).stop().animate({</font></p>
<p><font color="#804000">marginTop:&#8217;0&#8242;,</font></p>
<p><font color="#804000">marginLeft:&#8217;0&#8242;,</font></p>
<p><font color="#804000">top:&#8217;0&#8242;,</font></p>
<p><font color="#804000">left:&#8217;0&#8242;,</font></p>
<p><font color="#804000">width:&#8217;100px&#8217;,</font></p>
<p><font color="#804000">height:&#8217;100px&#8217;,</font></p>
<p><font color="#804000">padding:&#8217;5px&#8217;},d.speedRemove);</font></p>
<p><strong>and for the title..</strong></p>
<p>&nbsp;</p>
<p><font color="#804000">$(this).find(&#8217;.title&#8217;).remove()})}}})</font></p>
<p>&nbsp;</p>
<p><strong><font size="4">How to download and include the plugin in your page</font></strong></p>
<p>&nbsp;</p>
<p>To include this plugin in your page and initialize it, simply define your list of images as follows:</p>
<p>&nbsp;</p>
<p><font color="#804000">&lt;ul class=&quot;thumb&quot;&gt;      <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;image1.jpg&quot; alt=&quot;Title 1&quot; /&gt;&lt;/a&gt;&lt;/li&gt;       <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;image2.jpg&quot; alt=&quot;Title 2/&gt;&lt;/a&gt;&lt;/li&gt;       <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;image3.jpg&quot; alt=&quot;Title 3&quot; /&gt;&lt;/a&gt;&lt;/li&gt;</font></p>
<p><font color="#804000">&lt;/ul&gt;</font></p>
<p>&nbsp;</p>
<p>and then call the script:</p>
<p><font color="#804000">&lt;script type=&quot;text/javascript&quot; src=&quot;</font><a href="http://code.jquery.com/jquery-latest.js&quot;"><font color="#804000">http://code.jquery.com/jquery-latest.js&quot;</font></a><font color="#804000">&gt;&lt;/script&gt;      <br />
&lt;script type=&quot;text/javascript&quot; src=&quot;zoomer.js&quot;&gt;&lt;/script&gt;       <br />
&lt;script type=&quot;text/javascript&quot;&gt;       <br />
$(document).ready(function(){       <br />
&nbsp;&nbsp;&nbsp;&nbsp; $(&#8217;ul.thumb li&#8217;).Zoomer({speedView:200,speedRemove:400,altAnim:true,speedTitle:400,debug:false});       <br />
});       <br />
&lt;/script&gt;</font></p>
<p>&nbsp;</p>
<p>and that&rsquo;s it!. You can download the tutorial pack or view a demo below. I hope this post was helpful.</p>
<p><center></p>
<p><img border="0" name="demobuttons" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/image_thumb1.png" id="demobuttons" usemap="#m_demo20buttons" alt="" /><br />
<map name="m_demo20buttons" id="m_demo20buttons">
<area shape="rect" coords="258,16,515,99" href="http://www.addyosmani.com/resources/zoomer/zoomer.html" title="Demo" alt="Demo" />
<area shape="rect" coords="0,15,258,100" href="http://www.addyosmani.com/resources/zoomer/zoomer.for.jquery-1.0.zip" alt="" /> </map>
</p>
<p></center></p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/zoomer-gallery-a-jquery-plugin-for-displaying-images-with-flash-like-zooming-effects/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>11 Ways to Increase Your jQuery Performance</title>
		<link>http://addyosmani.com/blog/11-ways-to-increase-your-jquery-performance/</link>
		<comments>http://addyosmani.com/blog/11-ways-to-increase-your-jquery-performance/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 23:06:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[faster]]></category>
		<category><![CDATA[improve]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[optimal]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://addyosmani.com/blog/11-ways-to-increase-your-jquery-performance/</guid>
		<description><![CDATA[&#160;
This post will give you 11 easy steps that are going to instantly improve your jQuery application’s performance. There isn’t anything that difficult in here and almost anyone can apply these methods to their project. If you’ve got a few extra tips you would like to share, please feel free to include them in the [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>This post will give you 11 easy steps that are going to instantly improve your jQuery application’s performance. There isn’t anything that difficult in here and almost anyone can apply these methods to their project. If you’ve got a few extra tips you would like to share, please feel free to include them in the comments section. We’d love to hear from you!.</p>
<p>&nbsp;</p>
<p><a class="thickbox" href="http://addyosmani.com/blog/wp-content/uploads/2009/11/cheatsheet.png"><img title="cheatsheet" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="163" alt="cheatsheet" src="http://addyosmani.com/blog/wp-content/uploads/2009/11/cheatsheet_thumb.png" width="516" border="0"></a> </p>
<p><span id="more-229"></span>
<p>&nbsp;
<p>Optimization is something that can help the users of your application achieve actions inside of it much quicker than they may currently be able to. Looking for a way to make that animated drag look smoother? Perhaps you’re accessing it using the least-optimal path. That navigation menu working slow? Perhaps you just need to get rid of some of the waste in your calls. If you feel like your script or jQuery app could use a little performance optimization, read on because this article is sure to help.
<p>&nbsp;
<p>Before we get started I would like for everyone to remember that you should only strive for optimization when there is a measured need for optimization. Changing neat code to something you or your developers may not be used to is something I would not advise unless you are all well experienced with jQuery and JavaScript syntax. jQuery is still blazingly fast without any performance improvements added (in a lot of cases). Most often, one cannot tell without resorting to metrics or viewing source if it’s the server that delivered these bits in the page, or client-side JavaScript.
<p>&nbsp;
<p>Some of the tips that in this article will seem straight-forward to some, but I think that giving ourselves a “refresher” is always helpful. I would also like to remind everyone that the man behind jQuery itself (John Resig) strongly recommends that your jQuery applications be heavily performance tested. There are some amazing articles on how to performance test your apps including <a href="http://ejohn.org/blog/deep-profiling-jquery-apps/">this one</a> from Resig on performance testing (which comes with a free plugin), this one on <a href="http://blog.dynatrace.com/2009/04/20/how-to-test-jquery-enabled-apps-using-json-with-visual-studio/">Ajax/JSON testing within Visual Studio</a> and Paul Irish’s interesting presentation on Anti-patterns in performance and compression <a href="http://www.slideshare.net/paul.irish/perfcompression">here</a>. If you are going to try improving the performance of your application, guage how long it takes for core functions to be executed, discover what is causing any slow-down (is it the server? is the browser? is it the rendering engine, or is it my code?) and then set out a plan for how you are going to improve your application.
<p>&nbsp;
<p>With that in mind, let us begin!.
<p>&nbsp;<br />
<h4>jQuery Performance Tip 1: Always Descend From an #id</h4>
<p>&nbsp;</p>
<p>The fastest selector in jQuery is the ID selector (<code>$('#someid')</code>). This is because it maps directly to a native JavaScript method, <code>getElementById()</code>.<br />
<h5>&nbsp;</h5>
<h5>Selecting Single Elements</h5>
<p>&nbsp;</p>
<pre><font color="#804000">&lt;div id="content"&gt;
	&lt;form method="post" action="/"&gt;
		&lt;h2&gt;Traffic Light&lt;/h2&gt;
		&lt;ul id="traffic_light"&gt;
			&lt;li&gt;&lt;input type="radio" class="on" name="light" </font></pre>
<pre><font color="#804000">                          value="red" /&gt; Red&lt;/li&gt;
			&lt;li&gt;&lt;input type="radio" class="off" name="light"</font></pre>
<pre><font color="#804000">                       value="yellow" /&gt; Yellow&lt;/li&gt;
			&lt;li&gt;&lt;input type="radio" class="off" name="light" </font></pre>
<pre><font color="#804000">                            value="green" /&gt; Green&lt;/li&gt;
		&lt;/ul&gt;
		&lt;input class="button" id="traffic_button" type="submit" </font></pre>
<pre><font color="#804000">              value="Go" /&gt;
	&lt;/form&gt;
&lt;/div&gt;</font></pre>
<pre></pre>
<p>Selecting the button like this is slower:
<pre>var traffic_button = $('#content .button');</pre>
<p>Instead, select the button directly:
<pre>var traffic_button = $('#traffic_button');</pre>
<pre>&nbsp;</pre>
<pre></pre>
<h5>Selecting Multiple Elements</h5>
<p>Once we start talking about selecting multiple elements, we are really talking about DOM traversal and looping, something that is slow.</p>
<p>To minimize the performance hit, <b>always descend from the closest parent ID</b>:
<pre>var traffic_lights = $('#traffic_light input');</pre>
<pre>&nbsp;</pre>
<h4>jQuery Performance Tip 2: Use Tags Before Classes</h4>
<p>&nbsp;</p>
<p>The second fastest selector in jQuery is the Tag selector (<code>$('head')</code>). Again, this is because it maps to a native JavaScript method, <code>getElementsByTagName()</code>.</p>
<p>&nbsp;
<pre><font color="#804000">&lt;div id="content"&gt;
	&lt;form method="post" action="/"&gt;
		&lt;h2&gt;Traffic Light&lt;/h2&gt;
		&lt;ul id="traffic_light"&gt;
			&lt;li&gt;&lt;input type="radio" class="on" name="light" </font></pre>
<pre><font color="#804000">                             value="red" /&gt; Red&lt;/li&gt;
			&lt;li&gt;&lt;input type="radio" class="off" name="light" </font></pre>
<pre><font color="#804000">                        value="yellow" /&gt; Yellow&lt;/li&gt;
			&lt;li&gt;&lt;input type="radio" class="off" name="light" </font></pre>
<pre><font color="#804000">                     value="green" /&gt; Green&lt;/li&gt;
		&lt;/ul&gt;
		&lt;input class="button" id="traffic_button" type="submit" </font></pre>
<pre><font color="#804000">               value="Go" /&gt;
	&lt;/form&gt;
&lt;/div&gt;</font></pre>
<pre><font color="#804000">
</font></pre>
<p>Always prefix a class with a tag name (and remember to descend from an ID):
<pre>var active_light = $('#traffic_light input.on');</pre>
<pre>&nbsp;</pre>
<p><i>Note: The class selector is among the slowest selectors in jQuery; in IE it loops through the entire DOM. Avoid using it whenever possible.</i></p>
<p>&nbsp;
<p>Never prefix an ID with a tag name. For example, this is slow because it will loop through all <code>&lt;div&gt;</code> elements looking for the ‘content’ ID:</p>
<p>&nbsp;
<pre>var content = $('div#content');</pre>
<pre>
</pre>
<p>Along the same lines, it is redundant to descend from multiple IDs:
<pre>var traffic_light = $('#content #traffic_light');</pre>
<pre>&nbsp;</pre>
<h4>jQuery Performance Tip 3: Cache jQuery Objects</h4>
<p>&nbsp;</p>
<p>Get in the habit of saving your jQuery objects to a variable (much like our examples above).</p>
<p>For example, never (eeeehhhhver) do this:
<pre>$('#traffic_light input.on).bind('click', function(){...});
$('#traffic_light input.on).css('border', '3px dashed yellow');
$('#traffic_light input.on).css('background-color', 'orange');
$('#traffic_light input.on).fadeIn('slow');</pre>
<p>Instead, first save the object to a local variable, and continue your operations:
<pre>var $active_light = $('#traffic_light input.on');
$active_light.bind('click', function(){...});
$active_light.css('border', '3px dashed yellow');
$active_light.css('background-color', 'orange');
$active_light.fadeIn('slow');</pre>
<pre>&nbsp;</pre>
<pre></pre>
<p><i>Tip: Since we want to remember that our local variable is a jQuery wrapped set, we are using $ as a prefix.</i></p>
<p><em></em>&nbsp;
<p>Remember, <b>never repeat a jQuery selection operation</b> more than once in your application.</p>
<p>&nbsp;<br />
<h5>Bonus Tip &#8211; Storing jQuery results for later</h5>
<p>&nbsp;</p>
<p>If you intend to use the jQuery result object(s) in another part of your program, or should your function execute more than once, cache it in an object with a <a href="http://www.webdevelopersnotes.com/tutorials/javascript/global_local_variables_scope_javascript.php3">global scope</a>.</p>
<p>&nbsp;
<p>By defining a global container with jQuery results, we can reference them from within other functions:</p>
<p>&nbsp;
<pre><font color="#804000">// Define an object in the global scope (i.e. the window object)
window.$my =
{
	// Initialize all the queries you want to use more than once
	head : $('head'),
	traffic_light : $('#traffic_light'),
	traffic_button : $('#traffic_button')
};

function do_something()
{
	// Now you can reference the stored results and manipulate them
	var script = document.createElement('script');
	$my.head.append(script);

	// When working inside functions, continue to save jQuery results
	// to your global container.
	$my.cool_results = $('#some_ul li');
	$my.other_results = $('#some_table td');

	// Use the global functions as you would a normal jQuery result
	$my.other_results.css('border-color', 'red');
	$my.traffic_light.css('border-color', 'green');
}</font></pre>
<pre></pre>
<h4>jQuery Performance Tip 4: Harness the Power of Chaining</h4>
<p>&nbsp;</p>
<p>The previous example can also be accomplished like this:</p>
<p>&nbsp;
<pre><font color="#804000">var $active_light = $('#traffic_light input.on');</font></pre>
<pre><font color="#804000">$active_light.bind('click', </font></pre>
<pre><font color="#804000"> function(){...})
	.css('border', '3px dashed yellow')
	.css('background-color', 'orange')
	.fadeIn('slow');</font></pre>
<pre>&nbsp;</pre>
<p>This allows us to write less code, making our JavaScript more lightweight.</p>
<p>&nbsp;<br />
<h4>jQuery Performance Tip 5:&nbsp; Use Sub-queries</h4>
<p>jQuery allows us to run additional selector operations on a wrapped set. This reduces performance overhead on subsequent selections since we already grabbed and stored the parent object in a local variable.</p>
<p>&nbsp;
<pre><font color="#804000">&lt;div id="content"&gt;
	&lt;form method="post" action="/"&gt;
		&lt;h2&gt;Traffic Light&lt;/h2&gt;
		&lt;ul id="traffic_light"&gt;
			&lt;li&gt;&lt;input type="radio" class="on" name="light" </font></pre>
<pre><font color="#804000">                        value="red" /&gt; Red&lt;/li&gt;
			&lt;li&gt;&lt;input type="radio" class="off" name="light" </font></pre>
<pre><font color="#804000">                       value="yellow" /&gt; Yellow&lt;/li&gt;
			&lt;li&gt;&lt;input type="radio" class="off" name="light" </font></pre>
<pre><font color="#804000">                   value="green" /&gt; Green&lt;/li&gt;
		&lt;/ul&gt;
		&lt;input class="button" id="traffic_button" type="submit" value="Go" /&gt;
	&lt;/form&gt;
&lt;/div&gt;</font></pre>
<pre>&nbsp;</pre>
<p>For example, we can leverage sub-queries to grab the active and inactive lights and cache them for later manipulation.</p>
<p>&nbsp;
<pre><font color="#804000">var $traffic_light = $('#traffic_light'),
	$active_light = $traffic_light.find('input.on'),
	$inactive_lights = $traffic_light.find('input.off');</font></pre>
<pre>&nbsp;</pre>
<p><i>Tip: You can declare multiple local variables by separating them with commas – save those bytes!</i></p>
<p><em></em>&nbsp;<br />
<h4>jQuery Performance Tip 6: Limit Direct DOM Manipulation</h4>
<p>&nbsp;</p>
<p>The basic idea here is to create exactly what you need in memory, and <b>then</b> update the DOM. This is not a jQuery best practice, but a must for efficient JavaScript. <a href="http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx#tip6">Direct DOM manipulation is slow</a>.</p>
<p>&nbsp;
<p>For example, if you need to dynamically create a list of elements, do not do this:</p>
<p>&nbsp;
<pre><font color="#804000">var top_100_list = [...], // assume this has 100 unique strings
$mylist = $('#mylist'); // jQuery selects our &lt;ul&gt; element

for (var i=0, l=top_100_list.length; i&lt;l; i++)
{
	$mylist.append('&lt;li&gt;' + top_100_list[i] + '&lt;/li&gt;');
}</font></pre>
<pre></pre>
<p>Instead, we want to create the entire set of elements in a string before inserting into the DOM:</p>
<p>&nbsp;
<pre><font color="#804000">var top_100_list = [...], // assume this has 100 unique strings
$mylist = $('#mylist'), // jQuery selects our &lt;ul&gt; element
top_100_li = ""; // This will store our list items

for (var i=0, l=top_100_list.length; i&lt;l; i++)
{
	top_100_li += '&lt;li&gt;' + top_100_list[i] + '&lt;/li&gt;';
}</font></pre>
<pre><font color="#804000">$mylist.html(top_100_li);</font></pre>
<pre><font color="#804000"></font>
</pre>
<p>Even faster, we should <b>always wrap many elements</b> in a single parent node before insertion:</p>
<p>&nbsp;
<pre><font color="#804000">var top_100_list = [...], // assume this has 100 unique strings
	$mylist = $('#mylist'), // jQuery selects our &lt;ul&gt; element
	top_100_ul = '&lt;ul id="#mylist"&gt;'; </font></pre>
<pre><font color="#804000">// This will store our entire unordered list

for (var i=0, l=top_100_list.length; i&lt;l; i++)
{
	top_100_ul += '&lt;li&gt;' + top_100_list[i] + '&lt;/li&gt;';
}
top_100_ul += '&lt;/ul&gt;'; // Close our unordered list

$mylist.replaceWith(top_100_ul);</font></pre>
<pre><font color="#804000"></font>
</pre>
<p>If you do the above and are still concerned about performance:</p>
<ul>
<li>Give jQuery’s <code>clone()</code> method a try. This creates a copy of the node tree, which you can manipulate “off-line” and then insert back in when you are ready.
<li>
<li>Use <a href="http://www.devguru.com/technologies/xmldom/quickref/obj_documentFragment.html">DOM DocumentFragments</a>. As the <a href="http://ejohn.org/blog/dom-documentfragments/">creator of jQuery points out</a>, they perform much better than direct DOM manipulation. The idea would be to create what you need (similar to what we did above with a string), and use the jQuery <a href="http://docs.jquery.com/Manipulation">insert or replace methods</a>.
<li></li>
</ul>
<h4>jQuery Performance Tip 7:&nbsp; Leverage Event Delegation (a.k.a. Bubbling)</h4>
<p>&nbsp;</p>
<p>Unless <a href="http://docs.jquery.com/Events/jQuery.Event#event.stopPropagation.28.29">told otherwise</a>, every event (e.g. click, mouseover, etc.) in JavaScript “bubbles” up the DOM tree to parent elements. This is incredibly useful when we want many elements (nodes) to call the same function.</p>
<p>Instead of binding an event listener function to many nodes—very inefficient—you can <b>bind it once</b> to their parent, and have it figure out which node triggered the event.</p>
<p>&nbsp;
<p>For example, say we are developing a large form with many inputs, and want to toggle a class name when selected.</p>
<p>&nbsp;
<p>A binding like this is inefficient:</p>
<p>&nbsp;
<pre><font color="#804000">$('#entryform input).bind('focus', function(){
	$(this).addClass('selected');
}).bind('blur', function(){
	$(this).removeClass('selected');
});</font></pre>
<p><font color="#804000">Instead, we should listen for the focus and blur events at the parent level:</font>
<pre><font color="#804000">$('#entryform).bind('focus', function(e){
	var cell = $(e.target);  </font></pre>
<pre><font color="#804000">// e.target grabs the node that triggered the event.
	cell.addClass('selected');
}).bind('blur', function(e){
	var cell = $(e.target);
	cell.removeClass('selected');
});</font></pre>
<pre>&nbsp;</pre>
<p>The parent node acts as a dispatcher and can then do work based on what <a href="http://docs.jquery.com/Events/jQuery.Event#event.target">target element</a> triggered the event.</p>
<p>&nbsp;
<p>If you find yourself binding one event listener to many elements, you are doing something wrong (and slow).</p>
<p>&nbsp;<br />
<h4>jQuery Performance Tip 8: Eliminate Query Waste</h4>
<p>&nbsp;</p>
<p>Although jQuery fails nicely if it does not find any matching elements, it still takes time to look for them. If you have one global JavaScript for your entire site, it may be tempting to throw every one of your jQuery functions into <code>$(document).ready(function(){ // all my glorious code })</code>.</p>
<p>Don’t you dare.</p>
<p>&nbsp;
<p>Only run functions that are applicable to the page. The most efficient way to do this is to use inline initialization functions so your template has full control over when and where JavaScript executes.</p>
<p>For example, in your “article” page template, you would include the following code before the body close:</p>
<p>&nbsp;
<pre><font color="#804000">&lt;script type="text/javascript&gt;
mylib.article.init();
&lt;/script&gt;
&lt;/body&gt;</font></pre>
<pre>&nbsp;</pre>
<p>If your page template includes any variety of modules that may or may not be on the page, or for visual reasons you need them to initialize sooner, you could place the initialization function immediately after the module.</p>
<p>&nbsp;
<pre><font color="#804000">&lt;ul id="traffic_light"&gt;
	&lt;li&gt;&lt;input type="radio" class="on" name="light" value="red" /&gt; Red&lt;/li&gt;
	&lt;li&gt;&lt;input type="radio" class="off" name="light" value="yellow" /&gt; Yellow&lt;/li&gt;
	&lt;li&gt;&lt;input type="radio" class="off" name="light" value="green" /&gt; Green&lt;/li&gt;
&lt;/ul&gt;
&lt;script type="text/javascript&gt;
mylib.traffic_light.init();
&lt;/script&gt;</font></pre>
<pre></pre>
<p>Your Global JS library would look something like this:</p>
<p>&nbsp;
<pre><font color="#804000">var mylib =
{
	article_page :
	{
		init : function()
		{
			// Article page specific jQuery functions.
		}
	},
	traffic_light :
	{
		init : function()
		{
			// Traffic light specific jQuery functions.
		}
	}
}</font></pre>
<pre>&nbsp;</pre>
<h4>jQuery Performance Tip 9: Defer to <code>$(window).load</code></h4>
<h4><code></code>&nbsp;</h4>
<p>There is a temptation among jQuery developers to hook everything into the <code>$(document).ready</code> pseudo event. After all, it is used in most examples you will find.</p>
<p>Although <code>$(document).ready</code> is incredibly useful, it occurs during page render while objects are still downloading. If you notice your page stalling while loading, all those <code>$(document).ready</code> functions could be the reason why.</p>
<p>&nbsp;
<p>You can reduce CPU utilization during the page load by binding your jQuery functions to the <code>$(window).load</code> event, which occurs after all objects called by the HTML (including <code>&lt;iframe&gt;</code> content) have downloaded.</p>
<p>&nbsp;
<pre><font color="#804000">$(window).load(function(){
	// jQuery functions to initialize after the page has loaded.
});</font></pre>
<pre></pre>
<p>Superfluous functionality such as drag and drop, binding visual effects and animations, pre-fetching hidden images, etc., are all good candidates for this technique.</p>
<p>&nbsp;<br />
<h4>jQuery Performance Tip 10: Compress Your JS</h4>
<p>&nbsp;</p>
<p>Okay, this isn’t jQuery related, but I had to include it. There is a tendency to make JavaScript functions and variables overly descriptive, which is essential for developers but irrelevant to users.</p>
<p>No more excuses, it’s time to build JS compression into our workflows. Comment the heck out of your code, and run it through a compression tool before launching to production.</p>
<p>&nbsp;
<p>Use <a href="http://www.julienlecomte.net/yuicompressor/">YUICompressor</a> to squeeze out wasteful bytes from your code. In our experience, it safely compresses JavaScript as small as it can possibly get without a CPU penalty (such as Base62 encoding with <a href="http://dean.edwards.name/packer/">Packer</a>).</p>
<p>&nbsp;
<p><i>Tip: For maximum compression in YUICompressor, always declare your variables (e.g. var my_long_variable_name;).</i></p>
<p><em></em>&nbsp;<br />
<h4>jQuery Performance Tip 11:&nbsp; Learn the Library!</h4>
<p>&nbsp;</p>
<p>Print out this <a href="http://acodingfool.typepad.com/blog/jquery-13-cheat-sheet.html">jQuery 1.3 cheat sheet</a>, and make it a goal to eventually understand what each function does. If you find yourself repeating yourself repeating, there is probably an easier (and more efficient) way. jQuery 1.4 will hopefully be released right around the corner, but this should prove an excellent resource until then.</p>
<p>&nbsp;
<p><a href="http://www.artzstudio.com/files/jquery-rules/jquery_1.3_cheatsheet_v1.pdf"><img height="212" alt="jquery cheat sheet" src="http://www.artzstudio.com/files/jquery-rules/jquery_13_cheatsheet_thumb.jpg" width="336"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://addyosmani.com/blog/11-ways-to-increase-your-jquery-performance/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
	</channel>
</rss>
