Jump to content

Recommended Posts

Hi guys,

I'm messing about trying to suss how to do a slide down box that appears when the user clicks a link inside a fixed header at the top. The slide function works, I think, but it will slide down and then 'jump' to the left once it has completed the sliding action.

 

Below is the code I am using:

<script language="javascript" type="text/javascript">

$(document).ready(function() {
$("#open").click(function(){
	$("div.hiddenDiv").slideDown("slow");

});	

$("#close").click(function(){
	$("div.hiddenDiv").slideUp("slow");	
});	

});
</script>
<style type="text/css"> 
.hiddenDiv{
display:none;
height:150px;
width:200px;
background:yellow;
position:relative;
top:36px;
left:780px;
}
</style>

 

and the HTML:

<div id='headercontainer'>
<ul id='header'>
<li><a href='#'><img src='images/twitter.png' alt=''></a></li>
<li style='float:left;'><input type='text' id='search' value='Search...'></li>
<li><a href='#'><img src='images/facebook.png' alt=''></a></li>
<li><a id='open' href='#'><img src='images/shopcart.png' alt=''></a></li>
</ul>
<div class="hiddenDiv">
<!--Content goes in here -->
<a id='close' href='#'>Close</a>
</div></div><!-- Close Header Container -->

 

Any help would be greatly appreciated and of course I will post any other code if required.

Many thanks.

Link to comment
https://forums.phpfreaks.com/topic/264941-j-query-slide-down/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.