事件Events
# Documen/Window事件
window.onbeforeunload = function(event){}//頁面將要關(guān)閉時提醒用戶
window.onload = function(event){} //文檔加載完成
window.onerror = function(event){} //文檔加載出錯了
window.onscroll = function(event){} //拖動滾動軸
window.onresize = function(event){} //文檔大小有所變化
window.onpageshow=function(e){e.persisted '是否往返緩存中恢復的'}//頁面緩存打開
window.onpagehide=function(e){e.persisted '是否往返緩存中恢復的'}//頁面緩存關(guān)閉
window.onhashchange=function(e){};//URL參數(shù)列表發(fā)生變化時觸發(fā)
document.oncontextmenu=function(){}//右鍵菜單
document.onreadystatechange=function(event){
event.readyState == 'loading' 'loaded' 'complete'}//文檔或者元素加載狀態(tài)有關(guān)的信息
# 焦點事件
iput.addEventListener("focus",function(){},false);//獲取焦點
iput.addEventListener("blur",function(){},false);//失去焦點
# 鼠標事件
btn.addEventListener("click", function(event){});//單擊事件
btn.addEventListener("dbclick", function(event){});//雙擊事件
btn.addEventListener("mousedown", function(event){});//按下事件
btn.addEventListener("mouseup", function(event){});//松開事件
btn.addEventListener("mouseenter", function(event){});//進入事件(執(zhí)行1次)
btn.addEventListener("mouseover", function(event){});//進入事件(執(zhí)行多次)
btn.addEventListener("mousemove", function(event){});//移動事件
btn.addEventListener("mouseout", function(event){});//離開事件
btn.addEventListener("mouseleave", function(event){});//離開事件
btn.addEventListener("mousewheel", function(event){});//鼠標滾輪事件
# 移動端觸摸事件
document.addEventListener("touchstart", function(event){});//手指觸摸
document.addEventListener("touchend", function(event){});//手指松開
document.addEventListener("touchmove", function(event){});//手指移動
# 移動端手勢事件
document.addEventListener("gesturestart", function(event){});//一手在绢馍,二手來觸發(fā)
document.addEventListener("gesturechange", function(event){});//兩手有動觸發(fā)
document.addEventListener("gestureend", function(event){});//任何一只松開
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者