<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      jQuery on(),live(),trigger()

       

      jQuery on()方法是官方推薦的綁定事件的一個方法。

      $(selector).on(event,childSelector,data,function,map);

      由此擴展開來的幾個以前常見的方法有:

      bind()
        $("p").bind("click",function(){
          alert("The paragraph was clicked.");
        });
        $("p").on("click",function(){
          alert("The paragraph was clicked.");
        });
      delegate()
        $("#div1").on("click","p",function(){
          $(this).css("background-color","pink");
        });
        $("#div2").delegate("p","click",function(){
          $(this).css("background-color","pink");
        });
      live()
        $("#div1").on("click",function(){
          $(this).css("background-color","pink");
        });
        $("#div2").live("click",function(){
          $(this).css("background-color","pink");
        });

      以上三種方法在jQuery1.8之后都不推薦使用,官方在1.9時已經取消使用live()方法了,所以建議都使用on()方法。如果你需要移除on()所綁定的方法,可以使用off()方法處理。

      $(document).ready(function(){
        $("p").on("click",function(){
          $(this).css("background-color","pink");
        });
        $("button").click(function(){
          $("p").off("click");
        });
      });

      如果你的事件只需要一次的操作,可以使用one()這個方法

      $(document).ready(function(){
        $("p").one("click",function(){
          $(this).animate({fontSize:"+=6px"});
        });
      });

      trigger()綁定

      $(selector).trigger(event,eventObj,param1,param2,...)
      $(document).ready(function(){
        $("input").select(function(){
          $("input").after(" Text marked!");
        });
        $("button").click(function(){
          $("input").trigger("select");
        });
      });

      多個事件綁定同一個函數

      $(document).ready(function(){
        $("p").on("mouseover mouseout",function(){
          $("p").toggleClass("intro");
        });
      });

      多個事件綁定不同函數

      $(document).ready(function(){
        $("p").on({
          mouseover:function(){$("body").css("background-color","lightgray");},  
          mouseout:function(){$("body").css("background-color","lightblue");}, 
          click:function(){$("body").css("background-color","yellow");}  
        });
      });

      綁定自定義事件

      $(document).ready(function(){
        $("p").on("myOwnEvent", function(event, showName){
          $(this).text(showName + "! What a beautiful name!").show();
        });
        $("button").click(function(){
          $("p").trigger("myOwnEvent",["Anja"]);
        });
      });

      傳遞數據到函數

      function handlerName(event) 
      {
        alert(event.data.msg);
      }
      $(document).ready(function(){
        $("p").on("click", {msg: "You just clicked me!"}, handlerName)
      });

      適用于未創建的元素

      $(document).ready(function(){
        $("div").on("click","p",function(){
          $(this).slideToggle();
        });
        $("button").click(function(){
          $("<p>This is a new paragraph.</p>").insertAfter("button");
        });
      });

       

      posted @ 2014-12-27 19:17  nd  閱讀(4868)  評論(1)    收藏  舉報
      主站蜘蛛池模板: 性欧美vr高清极品| 清纯唯美经典一区二区| 夜夜春久久天堂亚洲精品| 久久久久综合一本久道| b站永久免费看片大全| 国产精品天干天干综合网| 亚洲精品一品二品av| 99re在线视频观看| 欧美极品色午夜在线视频| 免费一区二三区三区蜜桃| 无码福利写真片视频在线播放| 五月综合激情婷婷六月色窝| 漂亮的保姆hd完整版免费韩国| 久久99精品久久99日本| 亚洲激情一区二区三区在线| 无码人妻aⅴ一区二区三区蜜桃| 人与禽交av在线播放| 成人看的污污超级黄网站免费| 国产在线精品一区二区中文| 亚洲五月丁香综合视频| 美女禁区a级全片免费观看| 一本无码在线观看| 亚洲精品有码在线观看| 乱人伦中文字幕成人网站在线| A级毛片100部免费看| 辽中县| 亚洲性日韩精品一区二区| 国产综合色在线精品| 久久99精品久久久久久| 98精品全国免费观看视频| 人妻激情视频一区二区三区| 成人精品一区日本无码网| 欧美牲交a欧美牲交aⅴ免费真| 99热精品久久只有精品| 免费激情网址| 亚洲老熟女一区二区三区| 色视频不卡一区二区三区| 妺妺窝人体色WWW看人体| 在线日韩日本国产亚洲| 午夜成人精品福利网站在线观看| 国产成人8X人网站视频|