jQuery Tutorial plus Question:
Download Job Interview Questions and Answers PDF
Define slideToggle() effect?
Answer:
slideToggle() effect is used to give animated sliding effect to an element.
Syntax:
slideToggle([ duration] [, easing] [, callback])
"duration" is the number specifying how long the animation will run.
"easing" is the string which specify the function for the transition.
"callback" is the function which we want to run once the animation is complete.
If the element is visible then this effect will slide the element up side and make it completely hidden. If the element is hidden then slideToggle() effect will slide it down side and make it visible.
We can specify the toggle speed with this effect.
For example:
$("#clickme").click(function(){
$("#mydiv").slideToggle("slow", function(){
//run after the animation is complete.
});
});
Syntax:
slideToggle([ duration] [, easing] [, callback])
"duration" is the number specifying how long the animation will run.
"easing" is the string which specify the function for the transition.
"callback" is the function which we want to run once the animation is complete.
If the element is visible then this effect will slide the element up side and make it completely hidden. If the element is hidden then slideToggle() effect will slide it down side and make it visible.
We can specify the toggle speed with this effect.
For example:
$("#clickme").click(function(){
$("#mydiv").slideToggle("slow", function(){
//run after the animation is complete.
});
});
Download jQuery Interview Questions And Answers
PDF
Previous Question | Next Question |
Define each() function in jQuery? | Explain the difference between $(this) and 'this' in jQuery? |