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 相关文章推荐
js 数组操作代码集锦
Apr 28 Javascript
js怎么终止程序return不行换jfslk
May 30 Javascript
jQuery实现炫酷的鼠标轨迹特效
Feb 01 Javascript
JS遍历页面所有对象属性及实现方法
Aug 01 Javascript
js中获取 table节点各tr及td的内容简单实例
Oct 14 Javascript
javascript 利用arguments实现可变长参数
Nov 21 Javascript
Javascript实现的StopWatch功能示例
Jun 13 Javascript
详谈js模块化规范
Jul 07 Javascript
express默认日志组件morgan的方法
Apr 05 Javascript
jQuery实现鼠标移入移出事件切换功能示例
Sep 06 jQuery
JS 数组和对象的深拷贝操作示例
Jun 06 Javascript
OpenLayer学习之自定义测量控件
Sep 28 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
Discuz!下Memcache缓存实现方法
2010/05/28 PHP
解析MySql与Java的时间类型
2013/06/22 PHP
PHP 面向对象程序设计(oop)学习笔记 (二) - 静态变量的属性和方法及延迟绑定
2014/06/12 PHP
php curl抓取网页的介绍和推广及使用CURL抓取淘宝页面集成方法
2015/11/30 PHP
jquery常用技巧及常用方法列表集合
2011/04/06 Javascript
Javascript实现重力弹跳拖拽运动效果示例
2013/06/28 Javascript
js style动态设置table高度
2014/10/21 Javascript
jQuery实现平滑滚动到指定锚点的方法
2015/03/20 Javascript
JavaScript的Polymer框架中dom-repeat与VM的相关操作
2015/07/29 Javascript
JavaScript类型系统之基本数据类型与包装类型
2016/01/06 Javascript
基于javascript制作微博发布栏效果
2016/04/04 Javascript
老生常谈combobox和combotree模糊查询
2017/04/17 Javascript
微信小程序动态显示项目倒计时
2019/06/20 Javascript
详解基于Vue的支持数据双向绑定的select组件
2019/09/02 Javascript
[03:14]DOTA2斧王 英雄基础教程
2013/11/26 DOTA
python算法表示概念扫盲教程
2017/04/13 Python
python实现趣味图片字符化
2019/04/30 Python
Keras模型转成tensorflow的.pb操作
2020/07/06 Python
Django日志及中间件模块应用案例
2020/09/10 Python
Python实现手势识别
2020/10/21 Python
35款精致的 CSS3 和 HTML5 网页模板 推荐
2012/08/03 HTML / CSS
Tarte Cosmetics官网:美国最受欢迎的化妆品公司之一
2017/08/24 全球购物
Merchant 1948澳大利亚:新西兰领先的鞋类和靴子供应商
2018/03/24 全球购物
介绍一下RMI的基本概念
2016/12/17 面试题
开水果连锁店创业计划书
2013/12/29 职场文书
银行职员思想汇报
2013/12/31 职场文书
公司活动邀请函
2014/01/24 职场文书
化学教育专业自荐信
2014/07/04 职场文书
2015年国庆节慰问信
2015/03/23 职场文书
买卖合同纠纷代理词
2015/05/25 职场文书
导游词之江苏同里古镇
2019/11/18 职场文书
基于go interface{}==nil 的几种坑及原理分析
2021/04/24 Golang
详解JS ES6编码规范
2021/05/07 Javascript
MySQL 服务和数据库管理
2021/11/11 MySQL
68行Python代码实现带难度升级的贪吃蛇
2022/01/18 Python
MySQL慢查询中的commit慢和binlog中慢事务的区别
2022/06/16 MySQL