1.觸屏事件
2.cookie 本地存儲(chǔ)
3.jsonp
1.hammer.js
2.swiper.js
js兼容性代碼
事件對(duì)象 e || window.event
事件目標(biāo) e.target || e.srcElement
給元素添加滾輪事件
element.mousewheel = fn;
element.addEventListener && element.addEventListener("DOMMouseScroll", fn, false)
頁(yè)面的滾動(dòng)條
document.body.scrollTop || document.documentElement.scrollTop
獲取非行間樣式
window.getComputedStyle(element)
element.currentStyle
綁定事件
ele.addEventListener
ele.attachEvent
...
1.觸屏事件
touchstart/touchmove/touchend/touchcanclee.touch?
觸屏點(diǎn)的數(shù)組touchstart/touchmove?
事件可使用 e.touchtouchend 事件不能使用e.touches,而使用e.changedTouches
2.點(diǎn)透現(xiàn)象(移動(dòng)端開發(fā)的一些坑)
移動(dòng)端 touchstart click 移動(dòng)端有延遲300ms,原因:瀏覽器要判斷用戶是否有進(jìn)一步的操作[雙擊]
touchstartDOMContentLoaded 結(jié)構(gòu)節(jié)點(diǎn)渲染完畢觸發(fā)load 等待所有的資源[img/js/audio/vedio]加載完成才觸發(fā)
解決點(diǎn)透現(xiàn)象的方案:
使用fastclickdocument.addEventListener && document.addEventListener("DOMContentLoaded",function(){FastClick.attach(document.body);},false)
3.彈窗里面包含表單彈窗中的虛擬鍵盤使用fixed 定位,相對(duì)瀏覽器窗口,有輸入框的時(shí)候,虛擬鍵盤有可能遮擋表單輸入
4.上傳文件file.onchange = fn;file.files 上傳的圖片信息f.type/f.size/f.name縮略圖URL.createObjectURL()/FileReaderjson 利用script腳本