Wednesday, March 15, 2006

I found another interesting Javascript library. JQuery is a javascript library that is similar to Prototype. At first pass the most interesting feature is its support for chaining functions together like this:

$("p.surprise").addClass("ohmy").show("slow");

So like Prototype, you can grab and object with the $() function but then call the "addClass" method on that and call "show" on whatever that returns. This is more like how you would write Java or C# code and while it could turn into a visual mess it often makes things very clear.

JQuery is pretty small, only half the size of Prototype. Not that it does all of Prototype's features but if you are mainly using Prototype for features like $() then this might be a good alternative. You can use them together, but make sure you include Prototype first then JQuery.

JQuery also handles fading objects up or down. While not the full set of something like Scriptaculous or Rico, it is the probably most common effect and combined with the size savings may be worthwhile tradeoff.

I've been really conservative with Javascript in the past but have been jumping on the Ajax bandwagon and using a lot more features. My Javascript chops are still pretty good since I've been using the very similar Actionscipt in Flash. All these new libraries are making it a pleasure to execute even really complicated ideas.

0 Comments:

Post a Comment

<< Home