首页 >web前端 >js教程 >jQuery中关于live绑定多个事件整理的详解

jQuery中关于live绑定多个事件整理的详解

黄舟
黄舟原创
2017-06-26 09:18:581500浏览

  在1.4.0之前(不包含1.4.0)无法使用多个绑定的,单个示例为:

 $('.clickme').live('click', function() {
  // Live handler called.
  });

  1.4.0-1.4.2开始支持了,实例如下:

bjbzj.codeplex.com;
  shbjz.codeplex.com;
  tjbjz.codeplex.com;
  cqbjz.codeplex.com;
  hebbjz.codeplex.com;
  jlbjz.codeplex.com;
  sybjz.codeplex.com;
  dlbjz.codeplex.com;
  asbjz.codeplex.com;
  jnbjz.codeplex.com;
  qdbjz.codeplex.com;
  zbbjz.codeplex.com;
  dybjz.codeplex.com;
  ytbjz.codeplex.com;
  wfbjz.codeplex.com;
  tybjz.codeplex.com;
  xamjz.codeplex.com;
  sjzmt.codeplex.com;
  tsmt.codeplex.com;
  qhdmt.codeplex.com;
  lybjz.codeplex.com;
  zzmt.codeplex.com;
  whmt.codeplex.com;
  csbjz.codeplex.com;
  wxbjz.codeplex.com;
  njbjz.codeplex.com;
  szbjz.codeplex.com;
  nbbjz.codeplex.com;
  hzbjz.codeplex.com;
  fzbjz.codeplex.com;
  xmbjz.codeplex.com;
  kmbjz.codeplex.com;
  cdbjz.codeplex.com;
  hfbjz.codeplex.com;
  gybjz.codeplex.com;
  xzbjz.codeplex.com;
  ntbjz.codeplex.com;
  jsbjz.codeplex.com;
  zjbjz.codeplex.com;
  yzbjz.codeplex.com;
  ncbjz.codeplex.com;
  gzbjz.codeplex.com;
  szjzb.codeplex.com;
  zsbjz.codeplex.com;
  stbjz.codeplex.com;
  fsbjz.codeplex.com;
  lzbjz.codeplex.com;
  zhbjz.codeplex.com;
  hzmt.codeplex.com;
  ycbjz.codeplex.com;
  xnbjz.codeplex.com;
  whjz.codeplex.com;
  czmt.codeplex.com;
  bjbjz.codeplex.com;
  shmt.codeplex.com;
  tjjz.codeplex.com;
  cqjz.codeplex.com;
  hebjz.codeplex.com;
  jljz.codeplex.com;
  syjz.codeplex.com;
  dljz.codeplex.com;
  asjz.codeplex.com;
  jnjz.codeplex.com;
  qdjz.codeplex.com;
  zbjz.codeplex.com;
  dyjz.codeplex.com;
  ytjz.codeplex.com;
  wfjz.codeplex.com;
  tyjz.codeplex.com;
  xajz.codeplex.com;
  sjbjz.codeplex.com;
  tsjz.codeplex.com;
  qhbjz.codeplex.com;
  lyjz.codeplex.com;
  zzjz.codeplex.com;
  whbz.codeplex.com;
  csjz.codeplex.com;
  wxjz.codeplex.com;
  njjz.codeplex.com;
  szjz.codeplex.com;
  nbjz.codeplex.com;
  hzjz.codeplex.com;
  fzjz.codeplex.com;
  xmjz.codeplex.com;
  kmjz.codeplex.com;
  cdjz.codeplex.com;
  hfjz.codeplex.com;
  gyjz.codeplex.com;
  xzjz.codeplex.com;
  ntjz.codeplex.com;
  jhjz.codeplex.com;
  zjjz.codeplex.com;
  yzjz.codeplex.com;
  ncjz.codeplex.com;
  gzjz.codeplex.com;
  szgjz.codeplex.com;
  zsjz.codeplex.com;
  stjz.codeplex.com;
  fsjz.codeplex.com;
  lzjz.codeplex.com;
  zhjz.codeplex.com;
  fzmjz.codeplex.com;
  ycjz.codeplex.com;
  xnjz.codeplex.com;
  whmjz.codeplex.com;
  czjz.codeplex.com;
  $('.hoverme').live('mouseover mouseout', function(event) {
  if (event.type == 'mouseover') {
  // do something on mouseover
  } else {
  // do something on mouseout
  }
  });

  1.4.3之后的版本又开始支持另外一种更新的方法:

$('a').live({
  click: function() {
  // do something on click
  },
  mouseover: function() {
  // do something on mouseover
  }
  });
  //鼠标移入移出事件
  $(document).ready(function(){
  $('.title span').live({
  mouseenter:function(){
  alert('enter');
  },
  mouseleave:function(){
  alert('leave');
  }
  });
  });

以上是jQuery中关于live绑定多个事件整理的详解的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn