Solved

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

Posted on 2012-03-27
2
864 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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now