Practical opening, moving, and closing layer effects

Source: Internet
Author: User

<! DOCTYPE html>


<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>DOM_text01</title>
<style type= "Text/css" >
Body,span,div,td{font-size:12px;line-height:1.5em;color: #849BCA;}
#bodyL {
Float:left;
width:84px;
margin-right:2px;
}
a.od{
width:80px;
height:25px;
line-height:25px;
Text-align:center;
Font-weight:bold;
border:2px solid #849BCA;
Display:block;
Color: #547BC9;
Float:left;
Text-decoration:none;
margin-top:2px;
}
a.od:link{
Background: #EEF1F8;
}
a.od:visited{
Background: #EEF1F8;
}
a.od:hover{
Background: #EEE;
}
a.od:active{
Background: #EEE;
}
#fd {
width:500px;
height:200px;
Background: #EDF1F8;
border:2px solid #849BCA;
margin-top:2px;
margin-left:2px;
Float:left;
Overflow:hidden;
Position:absolute;
left:0px;
top:0px;
Cursor:move;
Float:left;
/*filter:alpha (OPACITY=50); * *
}
. content{
padding:10px;
}
</style>

<body>
<div id= "Bodyl" >
<a href= "#" class= "od" onclick = "Show (' fd '); return false;" >
[Open layer]
</a>
<a href= "#" class= "od" onclick = "closeed (' fd '); return false;" >
[Close layer]
</a>
</div>
<div id= "FD" style= "Display:none;filter:alpha (opacity=100); opacity:1;" >
<div class= "Content" ><div> Paris pick-up Network (www.balijieji.com) editor offers </div></div>
</div>
<script type= "Text/javascript" >
var ProX;
var Proy;
var Proxc;
var Proyc;
function Show (ID) {/*--open--*/
Clearinterval (ProX);
Clearinterval (Proy);
Clearinterval (PROXC);
Clearinterval (PROYC);
var o = document.getElementById (ID);
O.style.display = "block";
O.style.width = "1px";
O.style.height = "1px";
ProX = setinterval (function () {OpenX (o,500)},10);
}
function OpenX (o,x) {/*--Open x--*/
var cx = parseint (o.style.width);
if (CX < x)
{
O.style.width = (cx + math.ceil ((X-CX)/5) + "px";
}
Else
{
Clearinterval (ProX);
Proy = setinterval (function () {Openy (o,200)},10);
}
}
function Openy (o,y) {/*--Open y--*/
var cy = parseint (o.style.height);
if (Cy < y)
{
O.style.height = (cy + math.ceil ((y-cy)/5)) + "px";
}
Else
{
Clearinterval (Proy);
}
}
function Closeed (ID) {/*--close--*/
Clearinterval (ProX);
Clearinterval (Proy);
Clearinterval (PROXC);
Clearinterval (PROYC);
var o = document.getElementById (ID);
if (O.style.display = = "Block")
{
Proyc = setinterval (function () {Closey (o)},10);
}
}
function Closey (o) {/*--open y--*/
var cy = parseint (o.style.height);
if (Cy > 0)
{
O.style.height = (Cy-math.ceil (CY/5)) + "px";
}
Else
{
Clearinterval (PROYC);
PROXC = setinterval (function () {closex (o)},10);
}
}
function Closex (o) {/*--open x--*/
var cx = parseint (o.style.width);
if (cx > 0)
{
O.style.width = (Cx-math.ceil (CX/5)) + "px";
}
Else
{
Clearinterval (PROXC);
O.style.display = "None";
}
}
/*-------------------------Drag the mouse---------------------*/
var od = document.getElementById ("FD");
var dx,dy,mx,my,moused;
var Odrag;
var Isie = document.all? True:false;
Document.onmousedown = function (e) {
var e = e? E:event;
if (E.button = = (document.all? 1:0))
{
MouseD = true;
}
}
Document.onmouseup = function () {
MouseD = false;
Odrag = "";
if (Isie)
{
Od.releasecapture ();
od.filters.alpha.opacity = 100;
}
Else
{
Window.releaseevents (OD. MOUSEMOVE);
od.style.opacity = 1;
}
}
function Readymove (e) {
Od.onmousedown = function (e) {
Odrag = this;
var e = e? E:event;
if (E.button = = (document.all? 1:0))
{
mx = e.clientx;
my = E.clienty;
Od.style.left = od.offsetleft + "px";
Od.style.top = od.offsettop + "px";
if (Isie)
{
Od.setcapture ();
Od.filters.alpha.opacity = 50;
}
Else
{
Window.captureevents (Event.mousemove);
od.style.opacity = 0.5;
}
alert (MX);
alert (my);
}
}
Document.onmousemove = function (e) {
var e = e? E:event;
alert (MRX);
alert (E.button);
if (moused==true && Odrag)
{
var mrx = e.clientx-mx;
var mry = e.clienty-my;
Od.style.left = parseint (od.style.left) +mrx + "px";
Od.style.top = parseint (od.style.top) + Mry + "px";
mx = e.clientx;
my = E.clienty;
}
}
</script>


</body>

Practical opening, moving, and closing layer effects

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.