随笔分类 -  兼容性

摘要:由于placeholder是H5新属性,IE9及以下都不支持 解决办法:给input添加一个背景图,背景图里面添加placeholder内容,当焦点落在输入框中,背景图隐藏,即可做出类似的效果 代码: //引入jQuery框架$(function(){ if(!('placeholder' in d 阅读全文
posted @ 2017-05-31 17:18 CodeProducter 阅读(439) 评论(0) 推荐(0)
摘要:由于移动端是触摸事件,所以要用到H5的属性touchstart/touchmove/touched,但是PC端只支持鼠标事件,所以此时可以这样转换 var touchEvents = { touchstart:"touchstart", touchmove:"touchmove", touchend 阅读全文
posted @ 2016-10-02 19:14 CodeProducter 阅读(5904) 评论(1) 推荐(0)
摘要:<meta>的各个属性(移动端) 一.<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> na 阅读全文
posted @ 2016-08-28 19:19 CodeProducter 阅读(261) 评论(0) 推荐(0)
摘要:window.addEventListener('orientationchange', function(event){ if ( window.orientation == 180 || window.orientation==0 ) { alert("竖屏"); //竖屏事件处理 } if( 阅读全文
posted @ 2016-08-19 17:24 CodeProducter 阅读(1052) 评论(0) 推荐(0)
摘要:现在很多for Mobile的HTML5网页内都有快速滚动和回弹的效果,看上去和原生app的效率都有得一拼。 要实现这个效果很简单,只需要加一行css代码即可: -webkit-overflow-scrolling:touch; //IOS系统 overflow-scrolling:touch; / 阅读全文
posted @ 2016-08-16 09:57 CodeProducter 阅读(938) 评论(0) 推荐(0)