随笔分类 - 兼容
摘要:解决移动端 Retina 屏幕 1px 边框问题 一、概念 设备独立像素 = CSS 像素 = 逻辑像素,DIP,单位为px。 设备像素 = 物理像素,分辨率,单位为pt。 DPR( 设备像素比,devicePixelRatio)= 物理像素 / 逻辑像素。 二、造成边框变粗的原因 因为css中的1
阅读全文
摘要:透明度兼容问题 .box1{ background: #000; /*ie8及以下不兼容*/ opacity: .7; /*兼容ie8及以下*/ filter: Alpha(Opacity=70); } .box2{ /*ie8及以下不兼容 */ background: rgba(0,0,0,.7)
阅读全文
摘要:手机摇一摇,授权重力感应要在https环境下面测试 判断是否支持手机摇一摇 ios 13+ 的系统需要先授权才能摇动,获取权限需要点击事件才能触发 function addShakeEvent() { // 判断是否支持摇动 if (window.DeviceMotionEvent) { var u
阅读全文
摘要:console.log低版本会报错(ie9以下) 可以添加以下代码防止出错 window.console = window.console ||js (function() { var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.t
阅读全文