Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate a shim overlaying the entire page, but allowing mouseover events in the background
    primarykey
    data
    text
    <p>I need to create a shim for the entire page to capture click events, but the shim must not stop other events like mouseover etc on the other html elements on the page.</p> <p>I have solution that sort of works, but I am having a couple of problems with it: Whenever I click on the page, if I click directly on some text, the click event of the shim does not fire (there is no event-cancelling on the page).</p> <p>The onclick problem only occurs in IE.</p> <p>In FF and Chrome there is a problem with the mouseover events not being fired in the background, so I would of course appreciate any tips on solving that as well...</p> <p>Here is a very basic example demonstrating the problem.</p> <p>Any ideas? :-)</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; body { font-size:20px; height:100%; } #shim { position: absolute; padding: 0; margin: 0; top: 0px; left: 0px; width: 100%; height: 100%; zindex: 1; } #trace { border: 1px solid #ccc; height: 100px; } &lt;/style&gt; &lt;script type="text/javascript"&gt; function trace(e) { e = e || event; document.getElementById('trace').innerHTML = "Hovered innerHTML: " + (e.target || e.srcElement).innerHTML; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="shim" onclick="alert('shim clicked')"&gt; &lt;/div&gt; &lt;table border="1" onmouseover="trace(event)"&gt; &lt;tr&gt; &lt;td&gt; AAAAAA AAAAAA &lt;/td&gt; &lt;td&gt; BBBBBB BBBBB &lt;/td&gt; &lt;td&gt; CCCCCCCC CCCCC &lt;/td&gt; &lt;td&gt; DDDDDD DDDDDDDDDD &lt;/td&gt; &lt;td&gt; EEEEEE EEEE &lt;/td&gt; &lt;td&gt; FFFFFF FFFFF &lt;/td&gt; &lt;td&gt; GGGG GGGGGGGG &lt;/td&gt; &lt;td&gt; EEEE EEEE &lt;/td&gt; &lt;td&gt; FFFF FFFFFF &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="trace"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload