Web Usability & Website Optimization

Web Usability and SEO
A blog on » Web Usability   » Website Accessibility   » Search Engine Optimization (SEO)

Wednesday, September 26, 2007

jQuery

It is cool and amazing. jQuery is a light weight JavaScript library that does some awesome jobs in event handling, animation and Ajax interactions on a HTML file. They call it "The Write Less, Do More" JavaScript library which can do wonders if at all you are bothered about code optimization and adding some cool effects to your webpage. It is little complex but small and very powerful, lets take a look at following code:

$(document).ready(function() {
$("#Jmenu ul").hide();
$("#Jmenu li").filter("[ul]").hover(
function(){$(this).children("ul").show("slow");},
function(){$(this).children("ul").hide("slow"); });
});
The first line gets it ready for the Action. The second line searches for ul structures inside the parent ul with id=Jmenu and hides em all. The third line is the mouse over function on parent li nodes. The fourth line finds out if the mouse hovered li has child elements (ul) and if it has then shows them slowly (cool show effect) and the fifth line hides these elements again on mouse out. Don't forget to add jquery.js file in your html file, it can be found on their site. Now if I had to write the same code using typical JavaScript it would be hundreds of lines of code to get the same effect. That was just a small example of what jQuery can do, needless to say it can do many wonderful things that you might not have thought JavaScript can do.
jQuery programmers and enthusiasts have come up with lot of Plugins and the repository can be found at: http://jquery.com/plugins/
jQuery is happening and big thing, if you are a UI programmer, get acquainted with it, you will love it.

0 Comments:

Post a Comment

<< Home