JS实现简单易用的手机端浮动窗口显示效果


Posted in Javascript onSeptember 07, 2016

本文实例讲述了JS实现简单易用的手机端浮动窗口显示效果。分享给大家供大家参考,具体如下:

html:

<style type="text/css">
.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;}
</style>
<div class="fdBonTel">
  <img src="index/images/fdTel.gif" usemap="#Maps">
  <map name="Maps" id="Maps">
    <area shape="rect" coords="2,2,79,52" onClick="openZoosUrl();">
      <area shape="rect" coords="77,2,166,52" href="tel:0855-8253310">
      <area shape="rect" coords="166,4,242,51" onClick="openZoosUrl();">
    <area shape="rect" coords="248,5,318,53" onClick="openZoosUrl();">
  </map>
</div>
<div class="fdOnline" id="fdOnline">
  <a href="###" class="fdOClose f_r" onclick="closeOnline();"><img src="index/images/closeBtn.png" width="44" height="44"></a>
  <a href="###" class="fdOTel f_l"></a>
  <a href="###" class="fdOOn f_r"></a>
</div>

js:

// JavaScript Document
document.writeln("<style type=\"text/css\">");
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("</style>");
document.writeln("<div class=\"fdBonTel\">");
document.writeln(" <img src=\"index/images/fdTel.gif\" usemap=\"#Maps\">");
document.writeln(" <map name=\"Maps\" id=\"Maps\">");
document.writeln("   <area shape=\"rect\" coords=\"2,2,79,52\" onClick=\"openZoosUrl();\">");
document.writeln("     <area shape=\"rect\" coords=\"77,2,166,52\" href=\"tel:0855-8253310\">");
document.writeln("     <area shape=\"rect\" coords=\"166,4,242,51\" onClick=\"openZoosUrl();\">");
document.writeln("   <area shape=\"rect\" coords=\"248,5,318,53\" onClick=\"openZoosUrl();\">");
document.writeln(" </map>");
document.writeln("</div>");
document.writeln("<div class=\"fdOnline\" id=\"fdOnline\">");
document.writeln(" <a href=\"###\" class=\"fdOClose f_r\" onclick=\"closeOnline();\"><img src=\"index/images/closeBtn.png\" width=\"44\" height=\"44\"></a>");
document.writeln(" <a href=\"###\" class=\"fdOTel f_l\"></a>");
document.writeln("  <a href=\"###\" class=\"fdOOn f_r\"></a>");
document.writeln("</div>");
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);
});

效果图:

JS实现简单易用的手机端浮动窗口显示效果

希望本文所述对大家JavaScript程序设计有所帮助。

Javascript 相关文章推荐
懒就要懒到底——鼠标自动点击(含时间判断)
Feb 20 Javascript
跨浏览器开发经验总结(三)   警惕“IE依赖综合症”
May 13 Javascript
选择器中含有空格在使用示例及注意事项
Jul 31 Javascript
JS实现横向拉伸动感伸缩菜单效果代码
Sep 04 Javascript
jQuery实现的超简单点赞效果实例分析
Dec 31 Javascript
BootStrap Validator对于隐藏域验证和程序赋值即时验证的问题浅析
Dec 01 Javascript
使用jQuery的ajax方法向服务器发出get和post请求的方法
Jan 13 Javascript
js实现带简单弹性运动的导航条
Feb 22 Javascript
vue中动态设置meta标签和title标签的方法
Jul 11 Javascript
Vue中的vue-resource示例详解
Nov 02 Javascript
Vue scrollBehavior 滚动行为实现后退页面显示在上次浏览的位置
May 27 Javascript
关于Js中new操作符的作用详解
Feb 21 Javascript
利用Angularjs实现幻灯片效果
Sep 07 #Javascript
轻松掌握JavaScript状态模式
Sep 07 #Javascript
JS简单实现tab切换效果的多窗口显示功能
Sep 07 #Javascript
JS实现的幻灯片切换显示效果
Sep 07 #Javascript
javascript宿主对象之window.navigator详解
Sep 07 #Javascript
Angular 理解module和injector,即依赖注入
Sep 07 #Javascript
JS继承之借用构造函数继承和组合继承
Sep 07 #Javascript
You might like
在PHP中养成7个面向对象的好习惯
2010/01/28 PHP
php代码检查代理ip的有效性
2016/08/19 PHP
PHP数组生成XML格式数据的封装类实例
2016/11/10 PHP
php 数组处理函数extract详解及实例代码
2016/11/23 PHP
PHP实现mysqli批量执行多条语句的方法示例
2017/07/22 PHP
PHP输出Excel PHPExcel的方法
2018/07/26 PHP
event.keyCode键码值表 附只能输入特定的字符串代码
2009/05/15 Javascript
深入理解JavaScript系列(6) 强大的原型和原型链
2012/01/15 Javascript
Jquery UI震动效果实现原理及步骤
2013/02/04 Javascript
JS获取图片lowsrc属性的方法
2015/04/01 Javascript
JS实现为排序好的字符串找出重复行的方法
2016/03/02 Javascript
基于jQuery的网页影音播放器jPlayer的基本使用教程
2016/03/08 Javascript
Node.js+Express配置入门教程
2016/05/19 Javascript
jQuery简单注册和禁用全局事件的方法
2016/07/25 Javascript
浅谈js script标签中的预解析
2016/12/30 Javascript
Jquery+Ajax+xml实现中国地区选择三级联动菜单效果(推荐)
2017/06/09 jQuery
JavaScript之Date_动力节点Java学院整理
2017/06/28 Javascript
AngularJs 终极购物车(实例讲解)
2017/11/08 Javascript
详解Vue如何支持JSX语法
2017/11/10 Javascript
Vue实现购物车场景下的应用
2017/11/27 Javascript
Angular4实现图片上传预览路径不安全的问题解决
2017/12/25 Javascript
通过扫小程序码实现网站登陆功能
2019/08/22 Javascript
[10:49]2014国际邀请赛 叨叨刀塔第二期为真正的电竞喝彩
2014/07/21 DOTA
解决windows下Sublime Text 2 运行 PyQt 不显示的方法分享
2014/06/18 Python
Python使用面向对象方式创建线程实现12306售票系统
2015/12/24 Python
好的Python培训机构应该具备哪些条件
2018/05/23 Python
Python + Flask 实现简单的验证码系统
2019/10/01 Python
python如何实现递归转非递归
2021/02/25 Python
ASOS亚洲:ASOS Asia
2018/03/04 全球购物
西海岸男士和男童服装:Johnnie-O
2018/03/15 全球购物
C语言面试题
2015/10/30 面试题
中介公司区域经理岗位职责范本
2014/03/02 职场文书
幼儿园庆元旦主持词
2015/07/06 职场文书
Sql-Server数据库单表查询 4.3实验课
2021/04/05 SQL Server
SQL实现LeetCode(175.联合两表)
2021/08/04 MySQL
Python OpenGL基本配置方式
2022/05/20 Python