最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

.undelegate()

.undelegate( ) 返回: jQuery

描述: 為當前選擇所匹配的所有元素移除一個事件處理程序,現(xiàn)在或?qū)?,基于一組特定的根元素。

  • version added: 1.4.2.undelegate()

  • version added: 1.4.2.undelegate( selector, eventType )

    selector用于過濾事件結(jié)果的選擇器。

    eventType一個字符串,其中包含一個JavaScript事件類型,如“點擊”或“的keydown”

  • version added: 1.4.2.undelegate( selector, eventType, handler )

    selector用于過濾事件結(jié)果的選擇器。

    eventType一個字符串,其中包含一個JavaScript事件類型,如“點擊”或“的keydown”

    handler一個函數(shù),用來該事件被觸發(fā)后執(zhí)行。

  • version added: 1.4.3.undelegate( selector, events )

    selector用于過濾事件結(jié)果的選擇器。

    events一個或多個事件類型和以前綁定的功能映射到他們解除綁定。

  • version added: 1.6.undelegate( namespace )

    namespace一個字符串,其中包含一個命名空間取消綁定的所有事件。

Undelegate是用來移除使用.delegate()的方式已經(jīng)綁定的事件處理程序。它的工作原理與.die()用另外一個選擇器過濾參數(shù)(這是委托工作所需)幾乎相同。

Examples:

Example: 可以綁定和取消綁定事件的彩色按鈕。

<!DOCTYPE html>
<html>
<head>
  <style>
button { margin:5px; }
button#theone { color:red; background:yellow; }
</style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <button id="theone">Does nothing...</button>
<button id="bind">Bind Click</button>
<button id="unbind">Unbind Click</button>
<div style="display:none;">Click!</div>
<script>
function aClick() {
  $("div").show().fadeOut("slow");
}
$("#bind").click(function () {
  $("body").delegate("#theone", "click", aClick)
    .find("#theone").text("Can Click!");
});
$("#unbind").click(function () {
  $("body").undelegate("#theone", "click", aClick)
    .find("#theone").text("Does nothing...");
});
</script>

</body>
</html>

Demo:

Example: 解除綁定的所有段落都從委托的事件:

$("p").undelegate()

Example: 解除綁定的所有段落的所有委托點擊事件:

$("p").undelegate( "click" )

Example: 為了undelegate只是一個以前綁定的處理程序,通過在作為第三個參數(shù)的函數(shù):

var foo = function () {
// code to handle some kind of event
};

$("body").delegate("p", "click", foo); // ... now foo will be called when paragraphs are clicked ...

$("body").undelegate("p", "click", foo); // ... foo will no longer be called.

Example: 為了拆散他們的命名空間的所有委托事件:

var foo = function () {
// code to handle some kind of event
};

// delegate events under the ".whatever" namespace
$
("form").delegate("click.whatever", ":button", foo);

$
("form").delegate("keypress.whatever", ":text", foo);

// unbind all events delegated under the ".whatever" namespace

$
("form").undelegate(".whatever");
jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
灯塔市| 公主岭市| 平利县| 施甸县| 开化县| 勐海县| 宁津县| 宁德市| 甘德县| 余姚市| 新平| 大余县| 垦利县| 麦盖提县| 衡南县| 新营市| 广饶县| 永兴县| 阿克陶县| 上林县| 和田市| 墨江| 六安市| 丘北县| 静海县| 林西县| 宣化县| 宁蒗| 呼图壁县| 额尔古纳市| 平昌县| 洛阳市| 黄浦区| 湟源县| 青河县| 清涧县| 修文县| 泰宁县| 祁连县| 桐城市| 汾阳市|