我正在尝试使用兄弟 img 制作一个拖动框,并且可以拖动“move-obj”。它可以在其他浏览器中正常运行,但 IE(8,9,10)除外。在 IE 中,当您悬停边框时,您可以拖动“move-obj”,但如果您删除标签“img”它可以正常工作。我发现如果我向“move-obj”添加背景颜色,它也会正确运行,但这不是我想要的。有人可以给我一些建议吗?这是代码笔
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.wrap{
position: relative;
width: 100%;
height: 100%;
background-color: #f0f0f0;
padding: 10%;
}
.wrap-inside{
position: relative;
width: 500px;
height: 500px;
border: 1px solid #ddd;
}
.move-obj{
cursor: move;
position: absolute;
width: 100px;
height: 100px;
border: 1px solid blue;
}
.bg{
width: 500px;
height: 500px;
position: absolute;
}
</style>
</head>
<body>
<div class="wrap">
<img class="bg" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTE2qkLv64zdI4z5uIbE1oSMmI0AiQcbwbhAYAyI0cF2Dwg88tb" alt="">
<div class="wrap-inside">
<div class="move-obj"></div>
</div>
</div>
</body>
</html>