Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-26-2012, 03:50 AM   PM User | #1
Maxal
New to the CF scene

 
Join Date: Jun 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Maxal is an unknown quantity at this point
Question Top Sliding Panel Issue

Hi

I am trying to get a hidden div to slide over a visible div when a button of the hidden div is clicked. The problem is that when the hidden div slides in, it pushes the visible div down, instead of sliding over it. The sliding panel has a jQuery link in the header. Here are my codes:

Javascript

$(document).ready(function(){

$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});

});


Stylesheet

body {
margin: 0 auto;
padding: 0;
width: 570px;
font: 75%/120% Arial, Helvetica, sans-serif;

}
a:focus {
outline: none;
}
#panel {
background: #754c24;
width: 570px;
height: 100px;
display: none;

}
.slide {
margin: 0;
padding: 0;
border-top: solid 4px #422410;
background: url(images/btn-slide.gif) no-repeat center top;
position: relative;
}


.btn-slide {
background: url(images/white-arrow.gif) no-repeat right -50px;
text-align: center;
width: 144px;
height: 31px;
padding: 10px 10px 0px 0px;
margin: 0 auto;
display: block;
font: bold 120%/100% Arial, Helvetica, sans-serif;
color: #fff;
text-decoration: none;
}
.active {
background-position: right 12px;
}


HTML

<div style="display: none;" id="panel">
<!-- you can put content here -->
Sliding Panel text here
</div>

<p class="slide"><a href="#" class="btn-slide">Slide Panel</a></p>


<div>This is the text div.</div>
Maxal is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:59 PM.


Advertisement
Log in to turn off these ads.