Friday, February 20, 2015

fade toggle function in jQuery

fade toggle function in jQuery:

html file:

<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="fadetoggle.js"></script>
<style type="text/css">
.first
{
width:300px;
height:200px;
background:red;
display:none;
}
</style>
</head>
<body>
<input type="button" value="Toggle Button" id="toggle" />
<div class="first"></div>
</body>
</html>
___________________________________________________________________________

jquery(.js) file:

$(document).ready(function(){
$('#toggle').click(function(){
$('.first').fadeToggle();
});
});

No comments: