在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中文網其他相關文章!