Implementation Code of the pop-up form in the lower right corner of the webpage

Source: Internet
Author: User
Tags gety

Copy codeThe Code is as follows:
<! -- Start -->
<Style type = "text/css">
# Msg_win {position: absolute; right: 0px; display: none; overflow: hidden; z-index: 99; border: 1px solid # c00; background: # F9EFFC; width: 210px; font-size: 12px; margin: 0px ;}
# Msg_win. icos {position: absolute; top: 2px; * top: 0px; right: 2px; z-index: 9 ;}
. Icos a {float: left; color: # FFFFFF; margin: 1px; text-align: center; font-weight: bold; width: 14px; height: 22px; line-height: 22px; padding: 1px; text-decoration: none; font-family: webdings ;}
. Icos a: hover {color: # FFCC00 ;}
# Msg_title {background: # FA6705; border-bottom: 1px solid #710B97; border-top: 1px solid # FFF; border-left: 1px solid # FFF; color: # FFFFFF; height: 25px; line-height: 25px; text-indent: 5px; font-weight: bold ;}
# Msg_content {margin: 1px; margin-right: 0; width: 210px; height: 160px; overflow: hidden; text-align: center}
</Style>
<! -- End -->

<Div id = "msg_win" style = "display: block; top: 503px; visibility: visible; opacity: 1;">
<Div class = "icos"> <a id = "msg_min" title = "minimal" href = "javascript: void 0 ">_</a> <a id =" msg_close "title =" close "href =" javascript: void 0 "> × </a> </div>
<Div id = "msg_title"> title
</Div>
<Div id = "msg_content">
<Object classid = "clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
Codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width = "210" height = "160">
<Param name = "movie" value = "flvplayer.swf? Vcastr_file = userlogin/video/qlg. flv & IsAutoPlay = 1 "/>
<Param name = "quality" value = "high"/>
<Param name = "allowFullScreen" value = "true"/>
<Embed src = "flvplayer.swf? Vcastr_file = userlogin/video/qlg. flv & IsAutoPlay = 1 "allowFullScreen =" true "quality =" high"
Pluginspage = "http://www.macromedia.com/go/getflashplayer" type = "application/x-shockwave-flash" width = "210" height = "160"> </embed>
</Object>
</Div>
</Div>
<Script type = "text/javascript">
Var Message = {
Set: function () {// minimize and resume Switching
Var set = this. minbtn. status = 1? [0, 1, 'block', this. char [0], 'minimization ']: [1, 0, 'none', this. char [1], 'restore'];
This. minbtn. status = set [0];
This. win. style. borderBottomWidth = set [1];
This. content. style. display = set [2];
This. minbtn. innerHTML = set [3]
This. minbtn. title = set [4];
This. win. style. top = this. getY (). top;
},
Close: function () {// close
This. win. style. display = 'none ';
Document. all. xhs1.stop ();
Window. onscroll = null;
},
SetOpacity: function (x) {// sets the transparency.
Var v = x> = 100? '': 'Alpha (opacity = '+ x + ')';
This. win. style. visibility = x <= 0? 'Did': 'visible '; // IE has a bug where the absolute or relative content does not change with the parent transparency.
This. win. style. filter = v;
This. win. style. opacity = x/100;
},
Show: function () {// fade-in
ClearInterval (this. timer2 );
Var me = this, fx = this. fx (0,100, 0.1), t = 0;
This. timer2 = setInterval (function (){
T = fx ();
Me. setOpacity (t [0]);
If (t [1] = 0) {clearInterval (me. timer2 )}
}, 6); // 10 to 6
},
Fx: function (a, B, c) {// buffer computing
Var cMath = Math [(a-B)> 0? "Floor": "ceil"], c = c || 0.1;
Return function () {return [a + = cMath (B-a) * c), a-B]}
},
GetY: function () {// calculates the Moving Coordinate
Var d = document, B = document. body, e = document.doc umentElement;
Var s = Math. max (B. scrollTop, e. scrollTop );
Var h =/BackCompat/I. test (document. compatMode )? B. clientHeight: e. clientHeight;
Var h2 = this. win. offsetHeight;
Return {foot: s + h + h2 + 2 + 'px ', top: s + h-h2-2 + 'px '}
},
MoveTo: function (y) {// mobile Animation
ClearInterval (this. timer );
Var me = this, a = parseInt (this. win. style. top) | 0;
Var fx = this. fx (a, parseInt (y ));
Var t = 0;
This. timer = setInterval (function (){
T = fx ();
Me. win. style. top = t [0] + 'px ';
If (t [1] = 0 ){
ClearInterval (me. timer );
Me. bind ();
}
}, 6); // 10 to 6
},
Bind: function () {// bind the window scroll bar and size change event
Var me = this, st, rt;
Window. onscroll = function (){
ClearTimeout (st );
ClearTimeout (me. timer2 );
Me. setOpacity (0 );
St = setTimeout (function (){
Me. win. style. top = me. getY (). top;
Me. show ();
}, 100); // 600 mod 100
};
Window. onresize = function (){
ClearTimeout (rt );
Rt = setTimeout (function () {me. win. style. top = me. getY (). top}, 100 );
}
},
Init: function () {// Create HTML
Function $ (id) {return document. getElementById (id )};
This. win = $ ('msg _ win ');
Var set = {minbtn: 'msg _ min', closebtn: 'msg _ close', title: 'msg _ title', content: 'msg _ content '};
For (var Id in set) {this [Id] = $ (set [Id])};
Var me = this;
This. minbtn. onclick = function () {me. set (); this. blur ()};
This. closebtn. onclick = function () {me. close ()};
This. char = navigator. userAgent. toLowerCase (). indexOf ('Firefox ') + 1? ['_', ':', '×']: ['0', '2', 'R']; // FF does not support webdings Fonts
This. minbtn. innerHTML = this. char [0];
This. closebtn. innerHTML = this. char [2];
SetTimeout (function () {// initialize the first position
Me. win. style. display = 'block ';
Me. win. style. top = me. getY (). foot;
Me. moveTo (me. getY (). top );
}, 0 );
Return this;
}
};
Message. init ();
</Script>

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.