jQuery中bind函数绑定多个事件

jQuery中bind函数绑定多个事件
在jQuery中绑定多个事件名称是,使用空格隔开,举例如下:
$('#foo').bind('mouseenter mouseleave', function() {
  $(this).toggleClass('entered');
});
在1.4版本以后,也可以如下绑定
$('#foo').bind({
  click: function() {
    // do something on click
  },
  mouseenter: function() {
    // do something on mouseenter
  }
});
转自:http://www.cnblogs.com/wangjiping/archive/2010/06/16/1759245.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章