jquery Simple Popup layer (RPM)

Source: Internet
Author: User

Pre-defined HTML code: Not all code is generated and removed via JS.

Pre-defined CSS


/* Basic pop-up layer style */.my-popup-overlay {width:100%; Height:auto; /* Width height is defined by JavaScript */Position:absolute; top:0; left:0; z-index:1000; Background-color: #000; opacity:0.2; *filter:alpha (opacity=20);}. my-popup{position:fixed; top:200px; left:50%; /* Margin-left:; Defined by JS */_position:absolute; _top:expression (eval (document.documentElement.scrollTop + 200)); padding:10px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; Background:gray; z-index:1001;}. my-popup-close{Position:absolute; top:10px; right:10px; font-size:16px; width:20px; height:20px; Text-align:center; line-height:20px; Background: #0aa; Color: #f00; Cursor:pointer;}. my-popup-close:hover{Text-decoration:none; Color: #fff; Font-weight:bold;}. my-popup-content{background-color: #fff;} /* pop-up Layer style custom section */.popup-title{padding:25px 0 10px; font-size:14px;Text-align:center;}. popup-inner{width:300px; padding:20px;}

  Plug-in code and application examples

(function ($) {/* * jquery Simple Popup * Body content passed in as parameter */var popup = function (HTML) {//html popup body A pop-up layer with a matte var $overlay = $ ("<div class= ' My-popup-overlay ' ></div>"),//define borders and Close buttons only, the rest defined in Parameters $popup = $ ("<div class= ' My-popup ' >" + "<a class= ' My-popup-close ' >x&lt                         ;/a> "+" <div class= ' my-popup-content ' > "+ (HTML? HTML:" ") +        "</div>" + "</div>"); return {show:function () {//$overlay and $popup append to Body $ ("body"). App                End ($overlay). Append ($popup);                var = this;                $overlay. css ({width: $ (window). Width (), Height: $ (document). Height ()                });             $popup. css ({"Margin-left":-($popup. Width ()/2) + "px"   });                $ (". My-popup-close"). On ("click", Function () {that.hide ();            });                }, Hide:function () {///remove this mask and pop-up layer $overlay. Remove ();            $popup. Remove ();    }        };    }; application example var pup1html = ' 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.