Solved

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

Posted on 2012-03-27
2
879 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
2 Comments
 
LVL 12

Accepted Solution

by:
Tony van Schaik earned 500 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

810 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