Supports floating windows in the lower right corner of various browsers. For more information, see.
The Code is as follows:
Script
Function $ (id)
{
Return document. getElementById (id );
}
Var LoginUI = !! Window. LoginUI || {};
LoginUI. getViewportWidth = function (){
Var width = 0;
If(document.doc umentElement & document.doc umentElement. clientWidth ){
Widthdomaindocument.doc umentElement. clientWidth ;}
Else if (document. body & document. body. clientWidth ){
Width = document. body. clientWidth ;}
Else if (window. innerWidth ){
Width = window. innerWidth-18 ;}
Return width;
}
LoginUI. getViewportHeight = function (){
Var height = 0;
If (window. innerHeight ){
Height = window. innerHeight-18 ;}
Else if(document.documentelement&document.doc umentElement. clientHeight ){
Height1_document.doc umentElement. clientHeight ;}
Else if (document. body & document. body. clientHeight ){
Height = document. body. clientHeight ;}
Return height;
}
LoginUI. getViewportScrollX = function (){
Var scrollX = 0;
If(document.documentelement&document.doc umentElement. scrollLeft ){
ScrollX=document.doc umentElement. scrollLeft ;}
Else if (document. body & document. body. scrollLeft ){
ScrollX = document. body. scrollLeft ;}
Else if (window. pageXOffset ){
ScrollX = window. pageXOffset ;}
Else if (window. scrollX ){
ScrollX = window. scrollX ;}
Return scrollX;
}
LoginUI. getViewportScrollY = function (){
Var scrollY = 0;
If(document.documentelement&document.doc umentElement. scrollTop ){
Scrollypolicdocument.doc umentElement. scrollTop ;}
Else if (document. body & document. body. scrollTop ){
ScrollY = document. body. scrollTop ;}
Else if (window. pageYOffset ){
ScrollY = window. pageYOffset ;}
Else if (window. scrollY ){
ScrollY = window. scrollY ;}
Return scrollY;
}
Function scrollMsgTip ()
{
Var t = LoginUI. getViewportHeight () + LoginUI. getViewportScrollY ()-$ ("msgtip"). offsetHeight;
$ ("Msgtip"). style. top = t + "px ";
$ ("Msgtip"). style. left = LoginUI. getViewportWidth () + LoginUI. getViewportScrollX ()-$ ("msgtip"). offsetWidth + "px ";
}
Function scrollTip ()
{
ScrollMsgTip ()
}
Window. onload = window. onscroll = scrollTip;
Script
The above is the js Code, and below is a floating window
The Code is as follows:
Dfddfdf