<script> function allowFormsInIscroll(){ [].slice.call(document.querySelectorAll('input, select, button')).forEach(function(el){ el.addEventListener(('ontouchstart' in window)?'touchstart':'mousedown', function(e){ e.stopPropagation(); }) }) } document.addEventListener('DOMContentLoaded', allowFormsInIscroll, false); </script>
iscroll須要一直監聽用戶的touch操做,以便靈敏的作出對應效果,因此它把其他的默認事件屏蔽了。css
<meta name="viewport" content="width=1200, target-densitydpi=high-dpi, user-scalable=no" />
document.documentElement.style.height = window.innerHeight + 'px';
input, textarea, button, a{-webkit-tap-highlight-color:rgba(0,0,0,0);}
-webkit-appearance: none;border-radius: 0
-webkit-background-size能夠作高清圖標,不過一些低版本的android只能識別background-size
-webkit-text-security: disc;
電腦模擬器上 img border-radius:50%; overflow:hidden;沒出現問題,到手機上 img四角成了方框;有時候border-radius百分比無效html
border-radius:50%; overflow:hidden;
var element=document.getElementsById(」btnShare」); element.addEventListener(‘touchstart’,function(){},false)
移動端仍是PC短 若是使用fixed 元素;元素不停渲染問題;這個能夠用谷歌瀏覽器開發者—esc -esc-rendering-show paint rectangles 查看
-webkit-transform:translateZ(0);
translateZ 還能修復部分 > 字符 問題;android
//文本框高度自動 var autoTextarea = function(elem, extra, maxHeight) { extra = extra || 0; var isFirefox = !!document.getBoxObjectFor || "mozInnerScreenX" in window, isOpera = !!window.opera && !!window.opera.toString().indexOf("Opera"), addEvent = function( type, callback) { elem.addEventListener ? elem.addEventListener(type, callback, false) : elem.attachEvent("on" + type, callback) }, getStyle = elem.currentStyle ? function(name) { var val = elem.currentStyle[name]; if (name === "height" && val.search(/px/i) !== 1) { var rect = elem.getBoundingClientRect(); return rect.bottom - rect.top - parseFloat(getStyle("paddingTop")) - parseFloat(getStyle("paddingBottom")) + "px" } return val } : function(name) { return getComputedStyle(elem, null)[name] }, minHeight = parseFloat(getStyle("height")); elem.style.resize = "none"; var change = function() { var scrollTop, height, padding = 0, style = elem.style; if (elem._length === elem.value.length) { return } elem._length = elem.value.length; if (!isFirefox && !isOpera) { padding = parseInt(getStyle("paddingTop")) + parseInt(getStyle("paddingBottom")) } scrollTop = document.body.scrollTop || document.documentElement.scrollTop; elem.style.height = minHeight + "px"; if (elem.scrollHeight > minHeight) { if (maxHeight && elem.scrollHeight > maxHeight) { height = maxHeight - padding; style.overflowY = "auto" } else { height = elem.scrollHeight - padding; style.overflowY = "hidden" } style.height = height + extra + "px"; scrollTop += parseInt(style.height) - elem.currHeight; document.body.scrollTop = scrollTop; document.documentElement.scrollTop = scrollTop; elem.currHeight = parseInt(style.height) < 100 ? parseInt(style.height) : 100 + "px" } }; addEvent("propertychange", change); addEvent("input", change); addEvent("focus", change); change(); }; autoTextarea(textsa);// 調用
其餘新增的css3注意細節 ios
ios Fixed + Input 失效解決辦法css3
參考淘寶的 就好web
參考網址chrome
http://www.ghugo.com/chrome-rendering-tools-1/ 這個很是好瀏覽器
http://blog.bingo929.com/transform-translate3d-translatez-transition-gpu-hardware-acceleration.htmlapp