我创建了 Div Over Image 按钮 css 样式的位置是绝对的,当我滚动页面时,div 也向下滚动 如何修复图像上的潜水按钮
#DamageDiv {
background-color:red;
position:absolute;
z-index:1000;/* heighest z-index show on top */
}
function DrawImage(e) {
var evt = e || window.event; // compliant with ie6
var posX = evt.clientX;
var posY = evt.clientY;
var iDiv = document.createElement('div');
iDiv.id = DamageType;
iDiv.style.top = posY + "px";
iDiv.style.left = posX + "px";
iDiv.style.width = "20px";
iDiv.style.height = "20px";
document.getElementsByTagName('body')[0].appendChild(iDiv);
}