我尝试使用此代码将不透明度更改为0.7:
//if div hasn't been mouseovered
if(!e.target.getAttribute('data-shade'))
e.target.style.background = color;
e.target.setAttribute('datashade', 1);
//else div has been mouse overed
else
e.target.style.cssText = 'opacity: 0.7';
为什么变白了?
*对不起英语不好