(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
打包下载
Statement: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