Wednesday, July 14, 2010

JQuery Continued...

This post is continuation of the yesterdays jQuery article. I am listing down the jQuery methods that i learned today.
toggle - instead of using show() and hide() methods we can use toggle() method.
$('#Button2').toggle('slow');
instead of
if ($("#Button2").is(':visible')) {$("#Button2").hide();}
else {$("#Button2").show();}

css class, mouseover, mouseout - addClass & removeClass can be used to add/remove CSS class to the elements as below.
$('#GridView1 tr').hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); })
Plugins - Lot of animation functionality is not included in the jQuery master file due to the size factor. Lot of plugins(http://plugins.jquery.com)available to download.
one of the good plugin for animation is Easing (http://plugins.jquery.com/project/Easing )
Chaining Actions - More than one action can be done by calling jQuery methods one on another.
$('p:last').effect('shake', { times: 5 }, 300).effect('highlight', {}, 3000).hide('explode', {}, 500);


No comments:

Post a Comment