admin管理员组文章数量:1303496
I have <div>
with width and height properties. I want to put <div>
over it, so the click events of the first <div>
will not be registered anymore.
For example, I have div and when I click on it something is happening, but when I put second <div>
over the first, clicking on the first <div>
area will now fire that click events anymore.
<div id="firstDiv" style="width:100px; height:100px">bla bla</div>
How to put another <div>
over "firstDiv" so I will not be able to change its elements? Is it possible?
I have <div>
with width and height properties. I want to put <div>
over it, so the click events of the first <div>
will not be registered anymore.
For example, I have div and when I click on it something is happening, but when I put second <div>
over the first, clicking on the first <div>
area will now fire that click events anymore.
<div id="firstDiv" style="width:100px; height:100px">bla bla</div>
How to put another <div>
over "firstDiv" so I will not be able to change its elements? Is it possible?
-
5
It's invalid (not standard) to have multiple html elements with the same id. I suggest you use
class
instead. – Sang Suantak Commented Dec 27, 2012 at 14:29 - 2 This is a great example of an XY problem. – JJJ Commented Dec 27, 2012 at 14:39
3 Answers
Reset to default 4just to disable click event to a div don't place extra div over it just use on()
and off()
from jQuery
Details : ON ,OFF
Still if you want to place a div over another try using css positioning and z-index
A nice way I've seen it done, and done it myself is to use a modal 'mask' overlay.
The grayed out transparent mask that covers the entire page, except for the element you're interacting with, eg. modal popup window.
You could do a mini version of it just within the popup and push the three non active divs behind it with CSS z-index.
One more way is to use the jQuery BlockUI plugin.
I personally like using something like this
pointer-events:none;
Disable's click events
本文标签: javascriptDisable div click eventsStack Overflow
版权声明:本文标题:javascript - Disable div click events - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741751459a2395856.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论