I upload my code on jsFiddle, you can see it there.
When you click on the link, the hidden FAQ section will show up, and it will push other divs down. But that is not what I want, I need all other divs stay where they are, and my hidden FAQ section just float on the top. Not sure how to do it. Not even sure if this should be done in HTML, CSS or jQuery.
My jQuery code:
$(function(){
$(".OpenTopMessage").click(function () {
$("#details").slideToggle("slow");
});
});
HTML code:
<div style="border: 1px solid #000;">
<span>link</span>
<span> | </span>
<span>link</span>
<span> | </span>
<span>link</span>
<span> | </span>
<span>link</span>
<span> | </span>
<span>link</span>
<span> | </span>
</div>
<div id="faqBox">
<table width="100%">
<tr><td><a href="#" id="openFAQ" class="OpenTopMessage">this is hte faq section</a></td>
</tr>
</table>
<div id="details" style="display:none">
<br/><br/><br/><br/><br/><br/><br/><br/>
the display style property is set to none to ensure that the element no longer affects the layout of the page
<br/><br/><br/><br/><br/><br/><br/><br/>
</div>
</div>
<br/><br/>
<div style="background:#c00;">other stuff heren the height reaches 0 after a hiding animation, the display style property is set to </div>
You could use
position:absoluteon the#detailsdiv.Example: http://jsfiddle.net/SrT2U/9/
You would need to fiddle with the
marginto get it to line up.EDIT: Noticing that you are using
margin:0 auto;to center the FAQ box. You may need to find another way in order to line up the box.EDIT 2:
I noticed if you placed the FAQ div inside the
#faqboxtable and then changemargin:0 auto;tomargin-top: 20px; margin-left:-16px;in the#detailsdiv and it all works well.Example 2: http://jsfiddle.net/SrT2U/13/
NB: placing the
divinside thetablelike so is not code to spec, but it does work re centering the FAQs.