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

.mouseout()

.mouseout( handler(eventObject) ) 返回: jQuery

描述: 為 "mouseout" 事件綁定一個處理函數(shù),或者觸發(fā)元素上的 "mouseout" 事件。

  • version added: 1.0.mouseout( handler(eventObject) )

    handler(eventObject)每次事件觸發(fā)時會執(zhí)行的函數(shù)。

  • version added: 1.4.3.mouseout( [ eventData ], handler(eventObject) )

    eventData將要傳遞給事件處理函數(shù)的數(shù)據(jù)映射。

    handler(eventObject)每次事件觸發(fā)時會執(zhí)行的函數(shù)。

  • version added: 1.0.mouseout()

這個函數(shù)的第一種用法是 .bind('mouseout', handler) 的快捷方式,第二種用法是 .trigger('mouseout') 的快捷方式。

當鼠標指針離開元素時,mouseout事件就會被發(fā)送到這個元素,任何HTML元素都可以接受此事件。

舉例來說,請看下面的HTML:

<div id="outer">
  Outer
  <div id="inner">
    Inner
  </div>
</div>
<div id="other">
  Trigger the handler
</div>
<div id="log"></div>

這個事件可以綁定到任何元素:

$('#outer').mouseout(function() {
  $('#log').append('Handler for .mouseout() called.');
});

現(xiàn)在當指針在Outer <div>元素上移出時,“Handler for .mousedown() called.”這個字符串將被添加到<div id="log">。當不同的元素被點擊時我們也可以觸發(fā)這個事件:

$('#other').click(function() {
  $('#outer').mouseout();
});

這些代碼執(zhí)行后,點擊Trigger the handler 同樣添加這個信息。

此事件類型可以導致由于事件冒泡引起的很多頭痛的問題。例如,在這個例子中當鼠標指針移出Inner元素,mouseout事件將被發(fā)送到Inner元素,然后冒泡到Outer元素 。這可能會不合時宜的觸發(fā)綁定的mouseout處理函數(shù)。這可以用一個替代方法,見討論. mouseleave ()。

Example:

Show the number of times mouseout and mouseleave events are triggered. mouseout fires when the pointer moves out of the child element as well, while mouseleave fires only when the pointer moves out of the bound element.

<!DOCTYPE html>
<html>
<head>
  <style>
div.out {
width:40%;
height:120px;
margin:0 15px;
background-color:#D6EDFC;
float:left;
}
div.in {
width:60%;
height:60%;
background-color:#FFCC00;
margin:10px auto;
}
p {
line-height:1em;
margin:0;
padding:0;
}
</style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  
<div class="out overout"><p>move your mouse</p><div class="in overout"><p>move your mouse</p><p>0</p></div><p>0</p></div>

<div class="out enterleave"><p>move your mouse</p><div class="in enterleave"><p>move your mouse</p><p>0</p></div><p>0</p></div>


<script>
    var i = 0;
    $("div.overout").mouseout(function(){
      $("p:first",this).text("mouse out");
      $("p:last",this).text(++i);
    }).mouseover(function(){
      $("p:first",this).text("mouse over");
    });

    var n = 0;
    $("div.enterleave").bind("mouseenter",function(){
      $("p:first",this).text("mouse enter");
    }).bind("mouseleave",function(){
      $("p:first",this).text("mouse leave");
      $("p:last",this).text(++n);
    });

</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
乐清市| 石棉县| 疏附县| 介休市| 台中县| 怀远县| 防城港市| 丁青县| 温泉县| 济阳县| 宾阳县| 千阳县| 抚州市| 江北区| 中方县| 铁岭市| 武宁县| 惠州市| 巧家县| 泰来县| 连云港市| 裕民县| 长春市| 水富县| 罗源县| 启东市| 长乐市| 阿巴嘎旗| 常德市| 江西省| 蓝田县| 涿鹿县| 辉南县| 连州市| 松溪县| 诏安县| 读书| 罗源县| 乌审旗| 临沂市| 许昌市|