Hello Readers,
slideToggle() effect is one of the jquery method and is used to give the sliding effect or the animated effect with a sliding motion and it works between slideUp() and slideDown() effect for the selected or matched elements.
Syntax :
$(selector).slideToggle(speed,easing,callback)
speed -this is a Optional parameter which specifies the speed of the slide effect.
easing - this is Optional parameter which specifies the speed of the element in different points of the animation.
callback - this is also a Optional parameter. This function to be executed after the slideToggle() method is completed.
Below is the Code Example :
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").slideToggle();
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>Toggle slideUp() and slideDown()</button>
</body>
</html>
In the above code, toggle the paragraph.
0 Comment(s)