If you want the div to appear on top of other elements without changing the position of the others, you need to set its CSS position property to absolute.
In your css files, specify the following:
#details{ position: absolute; left: 100px;
You can also do this using jQuery as follows:
$(".OpenTopMessage").click(function () { $("#details").slideToggle("slow"); $("#details").css("position", "absolute"); $("#details").css("left", "40px/*some value*/"); $("#details").css("top", "40px/*some value*/"); });
If you want to place the popup in the center of your window, you can use jQuery to center it, as shown below.
$(".OpenTopMessage").click(function () { $("#details").slideToggle("slow"); $("#details").css("position", "absolute"); window_width = $(window).width(); //Get the user window width window_height = $(window).height(); //Get the user window height $("#details").css("left", (window_width-$("#details").width())/2); $("#details").css("top", (window_height-$("#details").height())/2); });
Then your block will be centered.
In addition, you will probably find that your βthis hte faq sectionβ button is covered by your div, but you can easily enable the popup to close by adding a close button or by adding the following code:
$("body:not(#details)").click(function() { $("#details").slideToggle("slow"); });
This allows you to click anywhere on the page to close the target #details divs except the div itself.
Usually, if you are trying to create a popup or dialog, you can try using other pre-designed plugins, including jQuery UI ( http://jqueryui.com/dialog/ ) or blockUI ( http://www.malsup.com/jquery/ block / ), of which the former only supports dialogs, but the latter supports all kinds of pop-ups.