Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to Create a Modal to Cover Entire Web Page using CSS and JavaScript

Posted on 2012-03-27
2
Medium Priority
?
926 Views
Last Modified: 2012-08-14
I am new to web developing, and I was wondering how one would create a modal over an entire web page. The goal is to grey out the entire contents of the web page, coded in asp .net, and make a custom message box popup using JavaScript code. (I have attached the code for the basic *.aspx page for reference.) Could someone let me know what would be the basic method and the basic code, maybe illustrated with an example, to grey out an entire page and make a modal window appear on the page, without being a JavaScipt popup window, on the same page? Any help would be greatly appreciated.
healthRiskTerms.aspx
0
Comment
Question by:thenthorn1010
1 Comment
 
LVL 12

Accepted Solution

by:
Tony van Schaik earned 2000 total points
ID: 37773745
With only CSS this is quite tricky, because those Javascript lightbox/thickboxes also have some cross-browser fixes in it.

For example the way Firefox renders the opacity is different than in Internet Explorer and don't forget about all those older browser versions like IE6, IE8, quirksmode etc

If you want to use CSS for fixing everything is a lot of work, the javascripts versions do these checks and fixes for you based on the browser that visits your website.

The modal dialogs i use are these:

http://jqueryui.com/demos/dialog/
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
http://www.shadowbox-js.com/

My advice, use a javascript version it's more bulletproof. And it some much easier to maintain and use it for other purposes on your website, like loading an image in the dialog box or video, iframe and so on.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question