-1
我在嘗試創建非點擊型div時遇到了問題。stopPropagation()停止傳播錯誤
是的,它的繁殖停止,但停止什麼不應該停止,也不會停止我應該停止
JS
//screen has set stopPropagation
$("#smokeScreen").click(function(){
event.stopPropagation();
})
HTML
<div id="content">
<!-- lots of stuff that has to not be clickable while "smokeScreen is visible" -->
<!-- lots of stuff that has to not be clickable while "smokeScreen is visible" -->
<div id="smokeScreen">
<!-- covers whole viewport -->
<div id="form"><!-- another form stuff here --></div>
<!-- covers whole viewport -->
</div>
<!-- lots of stuff that has to not be clickable while "smokeScreen is visible" -->
<!-- lots of stuff that has to not be clickable while "smokeScreen is visible" -->
</div>
有趣的是,這段代碼讓所有的東西都可以點擊,除了形式...
那麼請,任何提示?
和指針事件:無;在CSS是不是一個解決方案,出於某種原因,它不工作爲簡單的CSS,我還沒有想到爲什麼,但我需要保持與舊瀏覽器的兼容性,這是非常新的聲明。
'event'沒有定義 –
@PranavCBalan雅,在FF –
提供[MCVE](http://stackoverflow.com/help/MCVE)。你綁定了任何「形式」後代事件還是什麼? –