在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
  }
});

相关文章:

  • 2022-12-23
  • 2021-08-24
  • 2022-01-22
  • 2021-06-11
  • 2022-03-11
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2021-08-26
  • 2021-09-03
  • 2022-12-23
  • 2021-11-09
相关资源
相似解决方案