JQuery Programmer Question:

Download Job Interview Questions and Answers PDF

How can we give face effect in jQuery?

JQuery Programmer Interview Question
JQuery Programmer Interview Question

Answer:

1. In jQuery we have three methods to give the fade effect to elements: fadeIn, fadeOut and fadeTo.
2. This methods change the opacity of element with animation.

Syntax:
$(selector).fadeIn(speed,callback)
$(selector).fadeOut(speed,callback)
$(selector).fadeTo(speed,opacity,callback)

1. "speed" can be one of following values : "slow", "fast", "normal" or milliseconds.
2. "opacity" specify the value that allows the fading to given opacity.
3. "callback" is the function which we want to run once the fading effect is complete.

For example
$("clickme").click(function()
{
$("mydiv").fadeTo("slow",0.50);
});

$("clickme").click(function()
{
$("mydiv").fadeOut(3000);
});

Download JQuery Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
How to make a ajax call using jQuery?What is .siblings() method in jQuery?