Introduction

Before reading this article, please go through the following articles:
In this article, we will learn about jQuery effects.The following effects will be covered.
  1. Add Class
  2. Color Animation
  3. Effect
  4. Hide
  5. Remove Class
  6. Show
  7. Switch Class
  8. Toggle
  9. Toggle Class
In my Part 1 article we learned how to add a jQuery Widget on a HTML element. In Part 2 we learned how to add jQuery Interactions on HTML elements. Now in this part, we will complete this jQuery Demystified series. jQuery effects are very important for making a good website design. It gives your site a smooth transition and a pleasant appeal. So what are we waiting for? Let's Dive In!

Quick Synopsis of Part 2

In Part 2 we cover the jQuery interactions. We covered the following effects:
Capture.PNG
Let's move ahead now on jQuery effects.
Preparing the workspace

Working with jQuery Effects

Add Class
Here we add the "addclsOP" in the div when the user clicks on it. This changes the property of the element on which the click is performed. ".addClass" has syntax like this:
".addClass("class_to_add",duration,other_options)".
a4p1.jpg
Remove Class
Here the class addclsOP is removed from the div when the user clicks on that div. The general syntax of ".removeClass" is
".removeClass("class_to_remove",duration,other_options)".
a4p2.jpg

Animate

a4p3.jpg

Effect

Here we are performing the "explode" effect on the div when the user clicks on it. We have various kinds of effects, like blind, fold, slide, pulsate and so on. The general syntax is .effect("Effect_name",duration,other_options).
a4p4.jpg

Hide

Here we are performing the "Hide" effect on the div when the user clicks on it. The general syntax is ".hide(["Effect_name"],[options],[duration],[callback])." Everything that is in [] is optional, so simply ".hide()" will also work.
a4p5.jpg

Switch Class

Here we are performin the "switchClass" effect on the div when the user clicks on it. The general syntax is ".switchClass("Current_class","New_class",[duration],[callback])". The callback event occurs when the switching is completed.
a4p6.jpg

Toggle Class

These two classes will be switched on click of the user.
Here we are performing the "toggleClass" effect on the div when the user clicks on it. The general syntax is ".toggleClass("Class_to_switch_with",[duration],[easing_type],[callback])." The class will be added on the div if it's not present and if it's present then it will be removed.
a4p7.jpg

Toggle

These two classes are the design of our slider.
Here we are performing the "toggle" effect on the div when the user clicks on it. It looks like a slider. The general syntax is ".toggle("effect_name",[options],[duration],[callback])".
a4p8.jpg

Summary

So in this article, we learned about jQuery effects and how to use them. We saw various effects that can be used to create various useful anim effects on a website. Now the jQuery is completed. It is demystified now. Your foundation is made, now you can start using it on your website and make it more attractive. If you are stuck somewhere then don't worry, the C#-forums are there. You can also have a look at jQuery UI API to check out the various options available for widgets.
Final output
a4p9.PNG
Don't forget to comment. :)