2012-12-07 83 views
4

我正在編輯一個顯示某些文本選擇的工具欄。我在IE中面臨的問題是閃爍的光標仍然顯示在工具欄上方。 這是特別發生在IE中。閃爍的光標在最上面。IE8,IE9,IE10閃爍光標問題

以下是此問題的示例:以重點出

$('.content').mouseup(function(e) { 
 
    $('.shy').css({ 
 
    top: e.pageY - 30 + 'px', 
 
    left: e.pageX - 30 + 'px' 
 
    }); 
 
    $('.shy').show(); 
 
});
.content { 
 
    height: 300px; 
 
    width: 300px; 
 
    border: 1px solid black; 
 
    overflow: hidden; 
 
    word-wrap: break-word; 
 
    z-index: 1; 
 
} 
 
.shy { 
 
    height: 100px; 
 
    width: 100px; 
 
    background-color: orange; 
 
    z-index: 2; 
 
    overflow: hidden; 
 
    word-wrap: break-word; 
 
    display: none; 
 
    position: absolute; 
 
}
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> 
 
<div contenteditable="true" class='content'>Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content</div> 
 
<div class='shy'> 
 
    <div>

是不是一種選擇,因爲在這種應用更多的組件和此修復程序不適用於那些情況下工作。修復需要完全自治。

+0

如果你不能操縱焦點,那麼你可能會失去運氣,因爲它似乎s光標本身是由瀏覽器控制的,正如[本例中]指出的那樣(http://www.tek-tips.com/viewthread.cfm?qid=1597485) –

+0

@ZachEsposito:是的,重點似乎是唯一的選項,但非常糟糕的選擇。這意味着我不得不在其他組件上進行修復,使其達到可滿足的程度。 – pickhunter

回答

0

只需添加

$('.shy').focus(); 

和光標會停止閃爍在IE7-IE10(測試)

http://jsfiddle.net/2QAxk/6/

UDP1 對不起沒看到你更新關於 '專注' 不是一個選項...