每次尝试访问.style属性时出现此问题。每次我尝试在javascript中使用.style修改CSS属性时都会发生这种情况。
code.js:9 Uncaught TypeError:无法读取属性' style'的 未定义 在HTMLImageElement。
for(var i = 0; i<description.length;i++) {
image[i].addEventListener("mouseover", function() {
description[i].style.visibility = visible;
description[i].style.opacity = 0;
var last = +new Date();
var tick = function() {
description[i].style.opacity = +description[i].style.opacity + (new Date() - last)/700;
last = +new Date();
if (+description[i].style.opacity < 1) {
(window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
}
};
tick();
});
}