15 February 2009

FxQueues update: now compatible with jQuery 1.3.1

For all FxQueues plugin users, I just pushed a new version (2.0.3) that is only compatible with jQuery 1.3.x, since many tests and the main example under 2.0.2 weren't working with jQuery's latest version.

So if you are using jQuery 1.3.1, you should be using FxQueues 2.0.3, otherwise you can stick to 2.0.2, as only internal changes have been done and there are no new features.


11 January 2009

jQuery Object Cache Update

After discussing with Andrew Luetgers some improvements that could be done to the Object Cache plugin, I updated the plugin to a new version.

The new improvement is that now you can store a selection automatically:

// Will store in cache $("#sidebarNav") with #sidebarNav key
$$("#sidebarNav");

This will let you avoid doing $("#menu").cache("menu"), which is a bit redundant. Now by doing $$("#menu") you will be able to store it in the cache and retrieve it automatically. There is also a reload option that you can pass to that call in order to, well, reload the the cached object with that selection:

// Will reload #sidebarNav with $("#sidebarNav")
$$("#sidebarNav", true);

You can grab the new version of the Object Cache plugin here.


20 November 2008

New jQuery plugin: Object Cache

Inspired by Benjamin Sterling's "Better jQuery Code" article I decided to develop a simple plugin to make his first point (Caching) easier... nothing fancy, just a few methods, but you will hopefully find it useful.

Its objective is to let you store a jQuery object with a simple key in a global cache, so that you can access the same object easily, without having to write the same selection, filtering or traversing code (i.e: $("#main < p") or $("#main").children(".selected").eq(0)).

Here is how it works:

// Store in cache - Returns current object
$("#mainNav").cache("main_navigation");

// Retrieve from cache - Returns cached object
$$("main_navigation"); // or jQueryCache("main_navigation");

// Remove from cache
$$.remove("main_navigation");

// Clear Cache
$$.clear();

// Load jQueryCache with noConflict to avoid overriding window.$$
$$.noConflict();

There is a lot of room for improvement, which will be done depending on the feedback I get, so feel free to contact me with any ideas or corrections you might come up with.

You can get the Jquery Object Cache plugin here.


18 November 2007

New jQuery queueing plugin

I'm beginning this blog with a jquery plugin I had to develop a few weeks ago for a project I'm working on.

Even though jQuery is a great javascript library, its latest version brings a queue control, it doesn't work for different elements. That is, if you had something like

$("#myDiv").animate({fontSize: "30px"}).animate({marginLeft: "40px"})

it would queue the animations. But what if you wanted to be able to queue different elements (just like Scriptaculous allows)? Well, that's the reason why I developed the jQuery Fx Queues plugin. So go ahead and check it out, and feel free to send me your comments or any bugs you find.