jQuery 1.2.6 drops, and it’s even faster

Posted by Neil on June 06, 2008

Yup, 1.2.6 is now out (and is still just primarily a bug fix drop for 1.2),  and the events handling functionality is 103% faster.  But wait, that’s just the headline:

  • CSS Selectors are 13% faster
  • .offset() is 21% faster
  • The DImensions plugin is now part of the core
  • toggle() can now accept more functions
  • attr() has had an overhaul
  • You can now unbind bound toggle() and one() functions
  • .index() supports jQuery collections
  • jQuery.makeArray can convert ANYTHING into an array
  • beforeSend() can cancel AJAX calls
  • You can now define your own animation speeds with the jQuery.fx.speeds object

For more information please see the release notes.

jQuery 1.2.3 out and about

Posted by Neil on February 11, 2008

jQuery 1.2.3 has been released.  Just a couple of small bug fixes and new functions in this release - but most important of all, it’s now fully compatible with Adobe AIR.

Also released if v1.5a of jQuery UI, and the new jQuery enchant library (which deals primarily with effects).

For more information please visit the jQuery blog here.

Connect recording of last week’s CFUG jQuery session. 1

Posted by Neil on February 05, 2008

There is now, available online, a connect recording of last week’s UKCFUG jQuery session that I did here.

For some reason, the sound hasn’t come out for first 35-odd minutes, and there is a couple of times where my connect client crashed causing me to drop out of the meeting (the demo gods were looking down on me).

UKCFUG - Introduction to jQuery 

Using jQuery and ColdFusion 7 with a little JSON glue 1

Posted by Neil on February 01, 2008

Yesterday, while presenting at the UKCFUG, a question was asked:

"How can I get ColdFusion to return me jSON encoded data, when I am still on version 7 and then use that data in jQuery?"

Well, I said I would blog the answer so it would be nice and clear, and this is that blog post.

In a nutshell, anything javascript loves jSON, the Javascript Object Notation (javascript speaking natively in simple terms). However, while in ColdFusion 8 you can easily get CFC's to return jSON encoded data, ColdFusion 7 did not include this, so we need to get a little more imaginative. Whilst not impossible by any means, it is definitely a little more tricky than in CF, so use that if you can.

To start off with, you obviously need some sort of function to get you your data to return to jQuery. Something like this should do:

[The requested file http://neilmiddleton.com/Mods/http://neilmiddleton.com/Mods/2008/02/cf 7_datasource.txt could not be found]

Now, thats a pretty simple function, nothing special at all. So how is this invoked? Well, one way of doing it is to create a gateway CFM file that calls your method and returns the result to the page (and this is by no means the only way). However, for this to render the data on the page it needs to convert it to something that takes the form of a string (jSON perhaps?). This is where you need to look at 3rd party code as there is no serializeJSON function in CF7.

Luckily, there is just such a bit of code, jSON.cfc . By using this we can convert pretty much anything into a jSON string for display. Like so:

[The requested file http://neilmiddleton.com/Mods/http://neilmiddleton.com/Mods/2008/02/cf 7_datagateway.txt could not be found]

So, now we have a URL that gives me some jSON data. All that is left is to write the jQuery to get this data and handle it. Luckily for us, that's real simple too:

[The requested file http://neilmiddleton.com/Mods/http://neilmiddleton.com/Mods/2008/02/cf 7_jsonscript.txt could not be found]

Put all this together (with Firebug in Firefox) and you should see the variable you set in CF appearing in your browser.

Now as I said, there are other ways of doing this, so have a think about what you're trying to do and you could probably find at least five other ways.

If you want to download jSON.cfc, it can be found here:

jSON CFC

Issue with jQuery sortables 1

Posted by Neil on January 28, 2008

I've just been spending a load of time with the jQuery UI library and more specifically the sortables extension. What this allows you to do is specify a list of items on your page as sortable, and then every item becomes draggable to re-sort the list as per the demo's here.

However, I've found an issue with the extension in that the update property doesn't fire when the sorting is done by the user (which is said to have been fixed in the next release). For me, this is a showstopper as I need to know the new order immediately, which means I've had to go elsewhere for my sortable lists.

Enter script.aculo.us, the UI extension for the good ol js framework prototype. This supplies much of the same functionality of jQuery UI, but in a much larger package (127K vs jQuery's 70Kb for the same functionality). So how do you work sortables in script.aculo.us?

Well, see the following code:

[The requested file http://neilmiddleton.com/Mods/http://neilmiddleton.com/Mods/2008/01/so rtables.txt could not be found]

This will provide you with pretty much the same functionality as the jQuery option, but will successfully fire the update function when sorting is completed. For more information see here.

Speaking at UKCFUG next week

Posted by Neil on January 22, 2008

Next Thursday I have been asked to present at the UKCFUG on the wonderful subject of jQuery.

During the session I will be talking about the library itself, what it's for and what it can do. I'll also be talking a little bit about the extensibility of the library as well as giving a demo of some of the capabilites and how easy it is to use.

For more details (location etc), visit the UKCFUG website

Getting the Flash player version number with jQuery 2

Posted by Neil on January 21, 2008

Earlier today a collegue asked me how to retrieve the version number of the flash player that was installed in the users browser. Initially this is impossible with jQuery out of the box, but is easy but utilizing the brilliant jQuery plugins structure.To start off, you need to utilize the jQuery Flash Plugin. This plugin allows you all sorts of interaction with the Flash Player and creating and modifying flash objects on the page.So, once this is in place, include the script in your page, and then run the following code to return the version number:

[The requested file http://neilmiddleton.com/Mods/http://neilmiddleton.com/Mods/2008/01/fl ashplayerdetect.js could not be found]

This will return you the string of the version number for flash (major.minor.revision).  Should you wish to break this apart simply split() as needed.