thebeebs | jQuery 1.4.4 Released with new fadeToggle feature
thebeebs
Learn the art of website security
 
 

jQuery 1.4.4 Released with new fadeToggle feature

by thebeebs 13. November 2010 07:41

jQuery

Last week jQuery 1.4.4 was released and I'm glad to tell you that the Microsoft CDN version of jQuery is now available at:

http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js 

JQuery also host their own CDN at http://code.jquery.com/jquery-1.4.4.min.js at the point of writing Google haven’t yet updated their CDN but when they do it’s info will be here.

1.4.4 is  is the fourth minor release of jQuery 1.4 and fixes a number of bug and adds a few improvements, they have also added the new fadeToggle method. All the fixes can be found here in the jQuery release notes.

 

So what is fadeToggle?

For a long time we have been able to toggle slide and class so I guess it makes sense to add this feature to fading as well. Basically you can use it to fade in or out a elements opacity without having to check it’s current visibility.

As with all jQuery effects you can disable the effect globally by using the following code:

jQuery.fx.off = true

Under the covers this sets the duration property to 0.

Using fadeToggle

It’s pretty simple to use. In the example below I added a reference to jQuery 1.4.4 then added a link and an Image with the ID of Teddy. In the onclick event of the link I added some jQuery to select the image object and then call the fadeToggle function.

<!DOCTYPE html> <head> <title>fadeToggle</title> <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js" language="javascript" type="text/javascript"></script> </head> <body> <a href="#" onclick="$('#teddy').fadeToggle()">Show or Hide the teddy </a> <br /> <img id="teddy" src="images/teddy.jpg" /> </body> </html>

 

Show or Hide the teddy


Tags:

Comments (2) -

rift online gold
rift online gold United States
3/12/2011 7:29:09 AM #

I'm lovin' the blog. Alot of interesting information here.

rift online gold
rift online gold United States
3/12/2011 7:46:46 AM #

This blog is so excellent.

Comments are closed