Click here to Skip to main content
15,895,746 members
Articles / Web Development / HTML

A Simple in-page Pop Up Panel

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
19 Dec 2012CPOL2 min read 16.1K   7  
How to design a simple in-page pop up panel
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ClientSide.aspx.cs" Inherits="InPagePopup.ClientSide" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Client Side - In-page Pop up</title>
    <link rel="stylesheet" href="Styles/Style.css" />
</head>
<body>
    <form id="form1" runat="server">
        <ul>
            <li>
                <input type="button" id="ModalPopUp_SemiTransparentBG" value="Modal PopUp with Semi Transparent Background" onclick="ShowModalPopUp_SemiTransparentBG();" />
            </li>
            <li>
                <input type="button" id="ModalPopUp_TransparentBG" value="Modal PopUp with Transparent Background" onclick="ShowModalPopUp_TransparentBG();" />
            </li>
            <li>
                <input type="button" id="PopUp_NoBG" value="PopUp without Background" onclick="ShowPopUp_NoBG();" />
            </li>
        </ul>
        <div id="SemiTransparentBG" class="fadePanel semiTransparent">
        </div>
        <div id="TransparentBG" class="fadePanel transparent">
        </div>
        <div id="PopUp" class="Popup">
            <div class="InnerPopup">
                <p>Here is the body of a pop up element.</p>
                <p id="PopUpBody"></p>
                <p>
                    <input type="button" id="Close" value="Close" onclick="ClosePopUp();" />
                </p>
            </div>
        </div>
        <script type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                //Hide all pop up related elements during page ready.
                ClosePopUp();
            });

            function ShowModalPopUp_SemiTransparentBG() {
                $("#SemiTransparentBG").show('slow');
                $("#PopUp").show('slow');
                $("#PopUpBody")[0].innerHTML = "This popup brings a visual effect that tell user, they are not allow to click the background controls until this popup being closed.";
            };

            function ShowModalPopUp_TransparentBG() {
                $("#TransparentBG").show('slow');
                $("#PopUp").show('slow');
                $("#PopUpBody")[0].innerHTML = "This popup <b>doesn't</b> brings a visual effect that tell user, they are not allow to click the background controls until this popup closed. </br> </br> <b>In fact</b>, they cannot click the background controls. ^^";
            };

            function ShowPopUp_NoBG() {
                $("#PopUp").show('slow');
                $("#PopUpBody")[0].innerHTML = "This popup will not block access to any visible background controls.";
            };

            function ClosePopUp() {
                $("#SemiTransparentBG").hide('slow');
                $("#TransparentBG").hide('slow');
                $("#PopUp").hide('slow');
            };
        </script>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Powercomp Software Sdn Bhd
Malaysia Malaysia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions