how to make DIV show up on top of other Divs

Posted by feelexit on Stack Overflow See other posts from Stack Overflow or by feelexit
Published on 2012-11-17T22:29:33Z Indexed on 2012/11/17 23:01 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

I upload my code on jsFiddle, you can see it there.

http://jsfiddle.net/SrT2U/2/

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>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
    <span>link</span>
    <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
    <span>link</span>
    <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
    <span>link</span>
    <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
    <span>link</span>
    <span>&nbsp;&nbsp;|&nbsp;&nbsp;</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>  

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html