Reputation: 5076
Want to know How to create modal dialog/pop up without title bar using javascript which will work on both IE and FF. Thanks.
Upvotes: 1
Views: 2092
Reputation: 3665
I do this with two divs. I lay one div over the whole screen and make it semi-transparent, then I lay my "popup" div in the center of the screen with a higher z-index. The popup div can then contain whatever content you want.
Upvotes: 1
Reputation: 41813
You're going to have to make a div
that sits--absolutely positioned--in the middle of the viewport (or wherever you want it) above all the other elements--using z-index
. This is where your content goes. Now, I recommend a film to go behind it, but above everything else--again using z-index
. Then place a handler on that film that places focus back on the "modal" div
. Also, you might want to place a focus handler all the other elements (not the "modal" div
), using event delegation, that places focus back on your "modal" div
--just to be sure.
You also might want to look at how jQuery UI does it. You'd only need to remove the title bar from. In fact, you probably could just use that one and mess with the CSS to hide the title bar.
Upvotes: 2