简体   繁体   中英

Simulated Click event between overlay elements

有一个HTML / CSS / JS函数,当div(在z-index:1000上)重叠5秒钟时,div(z-index:2000)可以模拟click事件。

Register a click event on the element that overlays and within the handler, trigger a click on the image element:

<div id="Overlay" style="z-index:2000">
</div>
<img id="OverlayedOn" src="/myimage" style="z-index:1000"/>

<script>
$('#Overlay').click(
    function(){
        $('#OverlayedOn').click();
    });
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM