FacebookTwitter

jQuery

jQuery is a library of javascript functions which makes javascript a bit easier to write - but it's still pretty complicated!

Warning: the facility to add jQuery places code in the HEAD area of your website on all public pages. This could mess your site up, so you're advised to think carefully if your website is important to your business for instance.

If having read the above, you're still keen, then read on.

Why would I want to use it?

How about an example: assuming the jQuery box is empty on your site, copy and paste the following line into it.

$('#controlbar_username').fadeOut(3000);

Click the Update button - when the page refreshes watch your name in the main admin bar at the top of the page. The section saying 'Logged in as...' should fade away in 3 seconds. (Remember to take that out once you've played with it as it's not doing anything useful!)

What is Javascript?

The way most web pages work depend upon 3 different languages.

  1. HTML creates a structure out of some text.
  2. CSS adds the styles: colour, fonts, backgrounds etc.
  3. Javascript lets you do things to a page after it has loaded in the user's browser.

In the case of the example above, once the page has fully loaded, javascript takes the bit of the page which has the ID 'controlbar_username' and fades it out over 3 seconds. (3,000 miliseconds)

What else can I do with jQuery?

The possibilities are endless, but you're on your own here, at least for now. We do hope to add some useful tips here later.

What about jQuery plugins?

If you're asking that question, then you clearly know a bit about this.

Spanglefish 2 currently includes the following:

  • jQuery 1.7.1
  • jQueryUI 1.8.13 with the Cupertino theme
  • fancybox

We do plan to allow you to upload and include other plugins in the future.