Home > Web Front-end > JS Tutorial > Floatable QQ online customer service_javascript skills

Floatable QQ online customer service_javascript skills

WBOY
Release: 2016-05-16 19:00:02
Original
1155 people have browsed it
复制代码 代码如下:

(function(){
QQMenuInt=_QQMenuInt;
moveQQmenu=_moveQQmenu;
function _QQMenuInt(){
QQMenu.style.position="absolute";
QQMenu.style.display="";
if(parseInt(document.documentElement.offsetWidth)>1024){
QQMenuPosition.Left =(parseInt(document.documentElement.offsetWidth)-1024-20);
}
if(QQMenuPosition.isRight){
QQMenu.style.right=QQMenuPosition.Left "px";
}else{
QQMenu.style.left=QQMenuPosition.Left "px";
}
QQMenu.style.top=QQMenuPosition.Top "px";
moveQQmenu();
}
function _moveQQmenu(){
var from=parseInt(QQMenu.style.top,10);
var yOffset;
var to=window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop;
to=to QQMenuPosition.Top;
if(to!=from){
yOffset = Math.ceil(Math.abs(to-from)/20);
if(tovar oldTop=parseInt(QQMenu.style.top,10);
QQMenu.style.top=(oldTop yOffset) "px";
}
if(QQMenu.style.display!="none"){
window.setTimeout("moveQQmenu()",QQMenuPosition.timeout);
}
}
})()


使用方法:
1、引入上面的js
2、在页面的最后面加上 

复制代码 代码如下:




QQMenu is the outermost ID of the floating layer
QQMenuPosition is to set the parameters related to the floating layer
Left: the offset of the layer relative to the left side. If isRight is true, it is the offset relative to the right
Top: The offset of the layer relative to the top
timeout: The layer movement time interval, the larger the time, the slower

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

打包下载
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template