Consider the following drawing:
rendered in Chrome by the following code:
HTML:
<div class="floor">
<div class="large ball zindex2" onclick="touch(this)">
<div>
/////////////////////////////////<br/>
/////////////////////////////////
</div>
</div>
<div class="small ball zindex1" onclick="touch(this)"></div>
</div>
<div id="log"></div>
Javascript:
function log(str) {
document.getElementById('log').innerHTML += '<br/>' + str;
}
function touch(ball) {
log(ball.className + ' clicked')
}
CSS:
.floor { background-color: #ddd; width:200px; height: 200px; }
.floor .ball { border-radius: 50%; overflow: hidden; color: #ff0; }
.ball.small { height:25px; width: 25px; background-color: #00f; }
.ball.large { height:150px; width: 150px; background-color: #555; }
.zindex1 { position:absolute; z-index:1; }
.zindex2 { position:absolute; z-index: 2; }
after clicking twice on the blue small ball, which is positioned absolutely lower than the grey ball.
Assuming the current layer positioning, how can I get the appropriate message when clicking anywhere on either the large ball or the small ball.