This tutorial helps to create simple slide panel using Jquery and CSS.
Here is the sample HTML Code.
HTML Code:
I created one div with id 'panel'. We can put our own content here.
And for sliding button i created one paragraph with class 'slide'.
And here is the Sample CSS Code.
Include above CSS code into style tag.
Jquery Code:
Include jquery.js file in head tag of html.
For Live Demo click here
Here is the sample HTML Code.
HTML Code:
<!doctype html>
<html>
<head>
<style></style>
<script></script>
</head>
<body>
<div id="panel">
<img style="float:left; "src="welcome-to-my-blog.jpg" align="center" height="100%"/>
< br/><br/>
<p><i><h1>Put your own content here</h1></i></p>
</div>
<p class="slide"><a href="#" class="btn-slide">Slide Panel</a></p>
</body>
</html>
I created one div with id 'panel'. We can put our own content here.
And for sliding button i created one paragraph with class 'slide'.
And here is the Sample CSS Code.
body {
margin: 0 auto;
padding: 0;
width: 570px;
font: 75%/120% Arial, Helvetica, sans-serif;
}
a:focus {
outline: none;
}
#panel {
background: #FAFAD2;
height: 200px;
display: none;
}
.slide {
margin: 0;
padding: 0;
border-top: solid 4px #422410;
background: url(images/button.gif) no-repeat center top;
}
.btn-slide {
background: url(images/white-arrow.gif) no-repeat right -50px;
text-align: center;
width: 144px;
height: 31px;
padding: 10px 10px 0 0;
margin: 0 auto;
display: block;
font: bold 120%/100% Arial, Helvetica, sans-serif;
color: #000000;
text-decoration: none;
}
.active {
background-position: right 12px;
}
Include above CSS code into style tag.
Jquery Code:
$(document).ready(function(){
$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});
});
Include jquery.js file in head tag of html.
For Live Demo click here
No comments:
Post a Comment