≡
  • 网络编程
  • 数据库
  • CMS技巧
  • 软件编程
  • PHP笔记
  • JavaScript
  • MySQL
位置:首页 > 网络编程 > HTML

弹出窗口的兼容实现方法

人气:817 时间:2018-09-26

这篇文章主要为大家详细介绍了弹出窗口的兼容实现方法,具有一定的参考价值,可以用来参考一下。

感兴趣的小伙伴,下面一起跟随四海网的小编罗X来看看吧。
CSS代码如下:

  html, body {
    margin: 0;
    padding: 0;
  }
  body {
  }
  #div1 {
    height: 2000px;
  }
  #floatedLayer {
    position: fixed;
    _position: absolute;
  }

/***  来自四海网 (www.q1010.com)***/
html代码如下:

  <div id="floatedLayer">
    <iframe src="demo.html" width="580" height="542" frameborder="no"></iframe>
  </div>
  <div id="div1"></div>
  <script type="text/javascript">
    var floatedLayer = document.getElementById("floatedLayer");
    function adjustPopupWin() {
      var height = document.documentElement.clientHeight,
        width = document.documentElement.clientWidth;       
      floatedLayer.style.left = Math.max((width - floatedLayer.offsetWidth) / 2, 0) + "px";
      floatedLayer.style.top = Math.max((height - floatedLayer.offsetHeight) / 2, 0) + "px";
    }
  </script>
  <!--[if IE 6]>
  <script type="text/javascript">
    function adjustPopupWin() {
      var height = document.documentElement.clientHeight,
        width = document.documentElement.clientWidth;
      floatedLayer.style.left = Math.max((width - floatedLayer.offsetWidth) / 2, 0) + document.documentElement.scrollLeft + "px";
      floatedLayer.style.top = Math.max((height - floatedLayer.offsetHeight) / 2, 0) + document.documentElement.scrollTop + "px";
    }
    window.onscroll = adjustPopupWin;
  </script>
  <![endif]-->
  <script type="text/javascript">
    window.onresize = adjustPopupWin;
    adjustPopupWin();
  </script>
</body>
</html>
<!--   来自 四海网 (www.q1010.com)-->

本文来自:http://www.q1010.com/175/1697-0.html

注:关于弹出窗口的兼容实现方法的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。

关键词:弹出窗口

您可能感兴趣的文章

上一篇:IE支持RGBa的背景色实现方法
下一篇:底部浮动条的一种兼容实现方法
热门文章
  • HTML5 文本内容显示三行,多余部分显示...,点击全部展开
  • HTML,CSS,font-family:中文字体和英文名称对照表
  • html 回到顶部的完整代码
  • 百度编辑器ueditor自动排版首行缩进四个字符实现方法
  • HTML 为元素添加一些透明度的简单方法
  • HTML/CSS 实现div居中、div内部元素垂直居中的简单示例
  • HTML 在textarea中选择文本的实现方法
  • CSS分页符示例
  • 【推荐】DIV+CSS入门菜鸟教程
  • HTML 点击超链接在iframe框架显示的实现方法
  • 最新文章
    • css实现移动端禁止手机长按图片弹出保存图片
    • 鼠标拖动DIV元素的实现方法
    • html 标签随机变色大小的简单示例
    • HTML 在textarea中选择文本的实现方法
    • CSS分页符示例
    • HTML 为元素添加一些透明度的简单方法
    • html 回到顶部的完整代码
    • HTML5 文本内容显示三行,多余部分显示...,点击全部展开
    • HTML/CSS 实现div居中、div内部元素垂直居中的简单示例
    • HTML,CSS,font-family:中文字体和英文名称对照表

四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。