Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want a div to show up on top of other elements without changing others' positions, you need to set it CSS property of position to absolute.</p> <p>In your css files specify the following:</p> <pre><code>#details{ position: absolute; left: 100px;//your desired position as regard to the left of your window top: 100px;//your desired position as regard to the top of your window } </code></pre> <p>You can also do that using jQuery as following:</p> <pre><code>$(".OpenTopMessage").click(function () { $("#details").slideToggle("slow"); $("#details").css("position", "absolute"); $("#details").css("left", "40px/*some value*/"); $("#details").css("top", "40px/*some value*/"); }); </code></pre> <p>If you want to still locate your pop-up box at the center of your window, you can use jQuery to center it as following.</p> <pre><code>$(".OpenTopMessage").click(function () { $("#details").slideToggle("slow"); $("#details").css("position", "absolute"); window_width = $(window).width(); //Get the user's window's width window_height = $(window).height(); //Get the user's window's height $("#details").css("left", (window_width-$("#details").width())/2); $("#details").css("top", (window_height-$("#details").height())/2); }); </code></pre> <p>Then your box will be centered.</p> <p>Also, you will probably find your button "this is hte faq section" is covered by your div, but you can easily enable closing the pop-up box by adding a close button or add the following code:</p> <pre><code>$("body:not(#details)").click(function() { $("#details").slideToggle("slow"); }); </code></pre> <p>This enables you to click on any part of the page to close the targeted div #details except for the div itself.</p> <p>Usually, if you are trying to make a pop-up box or dialog, you can try to use other pre-designed plugins, including jQuery UI (<a href="http://jqueryui.com/dialog/" rel="nofollow">http://jqueryui.com/dialog/</a>) or blockUI (<a href="http://www.malsup.com/jquery/block/" rel="nofollow">http://www.malsup.com/jquery/block/</a>), of which the former only supports dialogs but the latter supports all kinds of pop-up boxes.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload