이벤트가 중지되는 것은 아니며 더 이상 이벤트가있는 div를 클릭하지 않는 것입니다.
zIndex는 컨테이너를 기준으로하므로 zIndexing에주의하십시오. 부모보다 zIndex가 적은 컨테이너를 가질 수 없으며, 그렇지 않으면 컨테이너 뒤에서 이동할 것입니다. 은 "더러운"솔루션은 Z- 색인 모든 클릭으로 성장하는 것입니다 : 크롬에
<style type="text/css">
html, body{
width: 100%;
height: 100%;
}
.Movable{
height: 100px;
position: absolute;
width: 100px;
}
.black{
background-color: black;
}
.gray{
background-color: gray;
}
.wheat{
background-color: lightgray;
}
<div style="position: relative; z-index: 20;">
<p id="log" style="height: 1em; overflow-y: scroll;"></p>
<div onclick="log('clicked', this)" onmousedown="log('mousedown', this)" onmouseup="log('mouseup', this)" class="Movable black"></div>
<div onclick="log('clicked', this)" onmousedown="log('mousedown', this)" onmouseup="log('mouseup', this)" style="left: 25px; top: 55px;" class="Movable gray"></div>
<div onclick="log('clicked', this)" onmousedown="log('mousedown', this)" onmouseup="log('mouseup', this)" style="left: 55px; top: 75px;" class="Movable wheat"></div>
</div>
<script type="text/javascript">
var index = 1;
function log(msg, element)
{
element.style.zIndex = index++;
document.getElementById('log').innerHTML += "Log: " + msg + " -> " + element.className + "</br>";
}
</script>
작품, IE11 (영업 이익의하지 않았다)에 작동하고, 파이어 폭스에서 작동하고 있습니다. (내가 가지고있는 것들.) 좋았어! 이상하고, 허약하다는 측면에서 나를 걱정할 것이다. 하지만 좋았다! –
완벽하게 작동합니다! 고맙습니다. –
이벤트를 만지는 것보다보기가 쉬우 며 실제로 작동합니다. +1 나는 형제/어린이가 너무 많아서 조심스럽게 행동 할 수도 있습니다. (OP에 대한 문제는 아닙니다.) –