DomEvent

概述

DOM事件的实用功能

方法(Methods)

方法:

方法 参数 返回值 描述
addListener() <HTMLElement> el,<String> type,<Function> fn,<Object> context? this 给指定类别的DOM元素添加事件监听函数fn,传入this可指定上下文环境
removeListener() <HTMLElement> el,<String> type,<Function> fn this 移除元素上的事件监听
stopPropagation( ) <DOMEvent> e this 阻止指定事件的冒泡传播
preventDefault() <DOMEvent> e this 阻止正在发生事件的默认动作
stop( ) <DOMEvent> e this 同时进行stopPropagation和preventDefault
disableClickPropagation( ) <HTMLElement> el this 阻止指定元素的'click', 'doubleclick', 'mousedown' and 'touchstart'事件的冒泡传播
getMousePosition( ) <DOMEvent> e,<HTMLElement> container? Point 根据DOM事件获取鼠标与指定容器的相对位置,如果没有指定容器,则相对于整个页面
getWheelDelta() <DOMEvent> e Number 从mousewheel DOM事件中获取滚轮滚动的增量

results matching ""

    No results matching ""