本文实例讲述了JS实现简单易用的手机端浮动窗口显示效果。分享给大家供大家参考,具体如下:
html:
.fdBonTel{ width:100%; height:53px; position:fixed; background:#0052ae; text-align:center; left:0; bottom:0; z-index:999; } .fdOnline{ background:url(index/images/online.png) no-repeat; width:255px; height:181px; position:fixed; left:50%; margin-left:-128px; top:40%; z-index:999; border-radius: 15px; box-shadow: 0 0 20px rgba(10, 2, 4, 0.75);} .fdonline .fdOClose{ width:44px; height:44px; display:block; margin-top:-17px; margin-right:-6px;} .fdonline .fdOTel{ background:#CF3; width:127px; height:58px; display:block; margin-top:123px;} .fdonline .fdOOn{ background:#036; width:128px; height:58px; display:block; margin-top:96px;}
js:
// Javascript document
document.writeln("");
document.writeln(".fdBonTel{ width:100%; height:53px; position:fixed; background:#0052ae; text-align:center; left:0; bottom:0; z-index:999; }");
document.writeln(".fdOnline{ background:url(index/images/online.png) no-repeat; width:255px; height:181px; position:fixed; left:50%; margin-left:-128px; top:40%; z-index:999; border-radius: 15px; box-shadow: 0 0 20px rgba(10, 2, 4, 0.75);}");
document.writeln(".fdonline .fdOClose{ width:44px; height:44px; display:block; margin-top:-17px; margin-right:-6px;}");
document.writeln(".fdonline .fdOTel{ width:127px; height:58px; display:block; margin-top:123px;}");
document.writeln(".fdonline .fdOOn{ width:128px; height:58px; display:block; margin-top:96px;}");
document.writeln("");
document.writeln("");
document.writeln(" ");
document.writeln(" ");
document.writeln("");
document.writeln("");
document.writeln(" ");
document.writeln(" ");
document.writeln(" ");
document.writeln("");
function showonline() {
if (document.getElementById("fdOnline")) {
if (document.getElementById("fdOnline").style.display == "none") {
document.getElementById("fdOnline").style.display = "block";
}
}
}
function closeonline() {
document.getElementById("fdOnline").style.display = "none";
setInterval(chkSWT, 30000);
};
$(function(){
setInterval(showOnline, 30000);
});
效果图:
更多关于Javascript相关内容感兴趣的读者可查看本站专题:《Javascript遍历算法与技巧总结》、《Javascript切换特效与技巧总结》、《Javascript查找算法技巧总结》、《Javascript动画特效与技巧汇总》、《Javascript错误与调试技巧总结》、《Javascript数据结构与算法技巧总结》及《Javascript数学运算用法总结》
希望本文所述对大家Javascript程序设计有所帮助。



