<html>
<head>
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js">
</script>
<script type="text/javascript" language ="javascript">
$(document).ready(function()
{
$("#show").click(function()
{
$(".mydiv").show(1000);
});
$("#hide").click(function()
{
$(".mydiv").hide(1000);
});
});
</script>
<style>
.mydiv
{
width:100px;
height:100px;
border-radius:50px;
font-size:20px;
color:green;
line-height:100px;
text-align:center;
background:orange;
}
</style>
</head>
<body>
<div class ="mydiv">
CIRCLE
</div>
<input id="hide" type="button" value="Hide Circle"/>
<input id="show" type="button" value="Show Circle"/>
</body>
</html>
$(“button”).click(function()
{
$(“p”).toggle();
});
Effects | Description | Example |
---|---|---|
slideDown() | All the matched elements are revealed by adjusting their height and an optional callback is fired upon completion. Syntax : $(selector).slideDown() | $(“.flip”).click(function() { $(“.panel”).slideDown(); }); |
slideUp() | All the matched elements are hidden by adjusting their height and an optional callback is fired upon completion. Syntax : $(selector).slideUp() | $(“.flip”).click(function() { $(“.panel”).slideUp(); }); |
slideToggle() | The visibility of all the matched elements are toggled by adjusting their height and an optional callback is fired upon completion. Syntax : $(selector).slideToggle() | $(“.flip”).click(function() { $(“.panel”).slideToggle(); }); |
Effects | Description | Example |
---|---|---|
fadeIn() | All the matched elements are faded in by adjusting their opacity and an optional callback is fired after completion. Syntax: $(selector).fadeIn() | $(“button”).click(function() { $(“div”).fadeIn(3000); }); |
fadeOut() | All the elements are faded out by adjusting their opacity to 0, then set display to “none” and an optional callback is fired after completion. Syntax: $(selector).fadeOut() | $(“button”).click(function() { $(“div”).fadeOut(5000); }); |
fadeTo() | The opacity of all the matched elements are faded to a specified opacity and firing an optional callback after completion. Syntax: $(selector).fadeTo(speed,callback) | $(“button”).click(function() { $(“div”).fadeTo(“fast”,0.30); }); |