0
這裏是我的代碼:聚焦子元素,火災父元素模糊
<div tabindex="0" id="parent" style="margin-top:200px;margin-left:200px;background-color:black;height:100px;width:200px;">
<input type="text" style="width:80px;margin:5px auto;display:none">
<div>
$("#parent").blur(function() {
$(this).css("background-color", "blue").animate({
marginLeft : '+=50'
}, 400);
$("#parent>input").css("display", "none");
});
$("#parent>input").focus(function() {
$(this).css("display", "block");
});
$("#parent>input").blur(function() {
$(this).css("display", "none");
});
$("#parent>input").keyup(function(e) {
if (e.which === 13) {
console.log("enter");
}
});
着眼於輸入,導致模糊對父DIV被解僱,它導致的div消失,所以用戶無法在文本框內輸入任何文本!
什麼想法?
什麼是完整的工作流程?我知道你想要什麼,但你目前的解決方案是不好的。所以需要知道所有的步驟,以便我可以完成適當的實施。 – mrtsherman
我試圖模仿谷歌文檔/單詞評論插件,所以當用戶關注評論區域時,我需要將評論div移動(動畫)到左邊(靠近主文檔)並使文本框可見,然後讓他們要輸入一些評論和模糊,將div(評論區域)向右移動,並使文本框再次隱藏! –
同樣的問題在這裏http://stackoverflow.com/questions/18259754/ie-click-on-child-does-not-focus-parent-parent-has-tabindex-0 – Ouadie