Simple and easy application to show/hide a div in jquery
<!doctype>
<html>
<head>
<title>
Jquery Hide & Show DIV
</title>
<style>
#box{
background-color:yellow;
width:700px;
}
#box p{
padding:10px;
font-family:calibri;
}
#close{
color:blue;
font-family:arial;
margin-top:2px;
cursor:pointer;
border:1px solid green;
padding:5px;
}
#open{
font-family:calibri;
color:blue;
font-weight:bold;
display:none;
cursor:pointer;
}
</style>
</head>
<body>
<center>
<span id='open'> + Click Me To See The Message</span>
<div id='box'>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<br/>
<br/>Hello guys/girls how are you, just click on the <font color='red'>close me</font> option to close me
<br/><center><span id='close'>Close Me</span></center></p>
</div>
</center>
<!-- including the google hosted jquery-->
<script src='http://code.jquery.com/jquery-1.11.0.min.js'></script>
<script>
$(document).ready(function(){
$('#close').click(function(){ ///// when the close button is clicked referred by the "id=close"
$('#box').slideUp('slow'); //// slideUp / slideDown all are jquery animation to hide and show div
$('#open').slideDown('slow');
});
$('#open').click(function(){
$('#box').slideDown('slow');
$('#open').slideUp('slow');
});
});
</script>
</body>
</html>
Online Demo
<!doctype>
<html>
<head>
<title>
Jquery Hide & Show DIV
</title>
<style>
#box{
background-color:yellow;
width:700px;
}
#box p{
padding:10px;
font-family:calibri;
}
#close{
color:blue;
font-family:arial;
margin-top:2px;
cursor:pointer;
border:1px solid green;
padding:5px;
}
#open{
font-family:calibri;
color:blue;
font-weight:bold;
display:none;
cursor:pointer;
}
</style>
</head>
<body>
<center>
<span id='open'> + Click Me To See The Message</span>
<div id='box'>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<br/>
<br/>Hello guys/girls how are you, just click on the <font color='red'>close me</font> option to close me
<br/><center><span id='close'>Close Me</span></center></p>
</div>
</center>
<!-- including the google hosted jquery-->
<script src='http://code.jquery.com/jquery-1.11.0.min.js'></script>
<script>
$(document).ready(function(){
$('#close').click(function(){ ///// when the close button is clicked referred by the "id=close"
$('#box').slideUp('slow'); //// slideUp / slideDown all are jquery animation to hide and show div
$('#open').slideDown('slow');
});
$('#open').click(function(){
$('#box').slideDown('slow');
$('#open').slideUp('slow');
});
});
</script>
</body>
</html>
Online Demo
No comments:
Post a Comment
Thank your for your comment..your submitted coment will be live after admin approval