最新回答 / 落日无声
也可以啊 直接 e.stopPropagation() -- 标准;IE 清除冒泡 event.cancelBubble = true;if(e.stopPropagation) { e.stopPropagation() } else { e.cancelBubble = true;}
2018-08-25
https://github.com/2017coding/-demo 一个简单的JSdemo,有瀑布流布局,css3d动画,网格布局,JS的本地存储等,有兴趣的同学看一下哦
2018-01-16
按照老师打的代码,js效果实现不了,还好评论区有同学贴了有效的代码,感谢!!!
2017-10-07
也可以用闭包。不过老师对事件兼容处理的不错
var lis = document.getElementById("subject").getElementsByTagName("li");
for(var i = 0; i < lis.length; i++) {
! function(i) {
lis[i].onmouseover = function() {
for(var i = 0; i < lis.length; i++) {
lis[i].className = "";
}
this.className = "big";
}
}(i)
}
var lis = document.getElementById("subject").getElementsByTagName("li");
for(var i = 0; i < lis.length; i++) {
! function(i) {
lis[i].onmouseover = function() {
for(var i = 0; i < lis.length; i++) {
lis[i].className = "";
}
this.className = "big";
}
}(i)
}
2017-09-29