【JQuery】事件

1、前言瀏覽器

       接着上一章選擇器的知識,繼續啊jQuery的學習ide

 

2、內容性能

$(function(){}) 文檔初始化加載 event.pageX 相對於文檔左邊緣的鼠標位置 event.pageY 相對於文檔上邊緣的鼠標位置 event.preventDefault() 阻止元素髮生默認行爲 event.isDefaultPrevented() 指明是否調用了preventDefault() event.result 被指定事件處理器返回的最後一個值 event.target 哪一個DOM元素觸發了該元素 event.timeStamp 該事件發生時的時間 event.type 事件的類型 event.which 按了哪一個鍵或按鈕 bind 綁定事件(對當前存在元素) $(selector).bind("event",data,function) blur 元素失去焦點 $(selector).blur(function) change 元素(select,text,textarea)值發生變化 $(selector).change(function) click 點擊元素 $(selector).click(function) dbclick 雙擊元素 $(selector).dbclick(function) delegate 爲子元素添加事件,data可選 $(selector).delegate(childSelector,"event",data,function) undelegate 刪除由delegate()添加的事件 $(selector).undelegate(selector,"event",) die 移除經過live()方法向元素添加的事件 $(selector).die("event",function) error 元素遇到錯誤 $(selector).error(function) focus 元素得到焦點 $(selector).focus(function) keydown 按鈕按下過程 $(selector).keydown(function) keypress 按鈕按下擡起 $(selector).keypress(function) keyup 按鈕擡起 $(selector).keyup(function) live 附加事件,注意與bind的區別 $(selector).live("event",data,function) load 加載事件 $(selector).load(function) unload 離開頁面,只應用於window對象 $(window).unload(function) mouseup 鼠標擡起事件 $(selector).mouseup(function) mousedown 鼠標按下事件 $(selector).mousedown(function) mouseenter 鼠標進入元素事件 $(selector).ouseenter(function) mouseleave 鼠標離開被選元素事件 $(selector).mouseleave(function) mousemove 鼠標移動事件,慎用,影響性能 $(selector).mousemove(function) mouseout 鼠標離開被選元素或其子元素 $(selector).mouseout(function) one 爲元素綁定只能運行一次的事件 $(selector).one("event",data,function) resize 窗口調整大小 $(selector).resize(function) scroll 可滾動對象滑動元素 $(selector).scroll(function) select 當textarea或文本型的input元素的文本被選擇時 $(selector).select(function) submit 提交表單 $(selector).submit(function) toggle 輪流切換多個事件, 第一次點擊執行第一個function 第二次點擊執行第二個function ... $(selector).toggle(function1,function2,function3) 切換Hide()和Show()狀態 $(selector).toggle(speed,callback) 規定是否只顯示或只隱藏匹配元素,true顯示;false隱藏 $(selector).toggle(switch) trigger 觸發事件 $(selector).trigger("event", [param1,param2,...]) $(selector).trigger(eventObj) triggerHandler 觸發事件, 不冒泡, 不觸發瀏覽器事件, 隻影響第一個匹配項 $(selector).triggerHandler(function1,function2,function3) unbind 移除綁定事件 $(selector).unbind("event",function) $(selector).unbind(eventObj)
相關文章
相關標籤/搜索