jquery's Magnified Popup dialog box (without adding any jquery plugin) share _jquery

Source: Internet
Author: User
Many do not say, go straight to the theme, share a magnifying effect of the popup dialog, the project can be based on their own needs to write CSS, I intend to reuse the Metro style site.

It seems that the animation effect is cool, if the added effect of the treatment is better:
Copy Code code as follows:

<title></title>
<script src= "Scripts/jquery-1.4.1.min.js" type= "Text/javascript" ></script>
<style>
Body {background: #ace; font:12px/1.2 Arial, Helvetica, Sans-serif;}
UL li {background: #fff; margin:5px; width:100px; height:100px; float:left;}
#transition {
Background:transparent;
Display:none;
Position:absolute; top:50%; left:50%; z-index:50;
z-index:10001;
}
#content {
Background: #fff;
border:1px solid #666;
margin:-50px 0 0-50px;
width:100px; height:100px;
z-index:10001;
}
#mask {
Position:absolute;
top:0;
left:0;
width:100%;
height:100%;
Background-color: #000000;
Display:none;
z-index:10000;
}
. Close
{
width:30px;
height:20px;
background-color:red;
Cursor:pointer;
Display:none;
}
. closeshow
{
width:30px;
height:20px;
margin-left:50px;
margin-top:-100px;
background-color:red;
Cursor:pointer;
}
</style>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ (' ul Li '). Click (function (e) {
$ ("#mask"). Fadeto (500, 0.25);
$ ("#content"). HTML ("<div>Loading....</div>");
var $t = $ (' #transition '),
To = $ (this). offset ();
var height = $ (document). Height ();
var width = $ (document). width ();
$ (' #content '). css ({width:100, height:100});
$t. CSS ({
Top:to.top + 50,
Left:to.left + 50,
Display: ' Block '
}). Animate ({
TOP:HEIGHT/2,
Left:width/2
}, the function () {
$ (this). Animate ({
top:125,
left:175
}, 600);
$ (' #content '). Animate ({
Width:width * 0.8,
Height:height * 0.8
}, the function () {
Open dialog here
$ ("#content"). HTML ("<div>hello, please put content here.</div>");
});
});
});
$ (' #transition '). Click (function (e) {
$ ("#transition"). Hide ();
$ ("#mask"). Hide ();
});
});
</script>
<body>
<form id= "Form1" runat= "Server" >
<ul>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
</ul>
<div id= ' mask ' ></div>
<div id= "transition" ><div id= "content" >Loading....</div></div>
</form>
</body>

Add the mask effect, if you do not need to be deleted directly.

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.