减少事件绑定次数

listNum.onclick = function myCarousel(){
  var target = event.target ? event.target : event.srcElement;
  index = target.getAttribute('slide-to');
}

内部实现过程减少事件的绑定次数,提高性能;

先绑定父级,通过 event.target 获取子元素;

原文地址:https://www.cnblogs.com/yangjing1314/p/6795800.html