对于不支持fixed的浏览器,`window.getComputedStyle(div).position`计算出来的值会是`absolute`。
在这段代码的基础上,可以封装一个公共函数,并将已知的不支持fixed浏览器直接过滤掉。
如果不写z-index,浏览器在计算样式时,会将fixed计算成static
对于不支持fixed的浏览器,`window.getComputedStyle(div).position`计算出来的值会是`absolute`。
在这段代码的基础上,可以封装一个公共函数,并将已知的不支持fixed浏览器直接过滤掉。
如果不写z-index,浏览器在计算样式时,会将fixed计算成static
上一篇:极简原生双向绑定
下一篇:vue 防抖节流演示
先看一下position设置fixed的数据:
1.js代码: 更多参考: HTML5 文件处理之FileAPI简介整理 HTML5 FileAPI读取实例 (一)
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M