简体   繁体   English

IE8、IE9、IE10 闪烁光标问题

[英]IE8, IE9, IE10 Blinking Cursor Issue

I am making an editor which shows a toolbar on some text selection.我正在制作一个在某些文本选择上显示工具栏的编辑器。 The issue that I am facing in IE is that the blinking cursor still shows above the toolbar.我在 IE 中面临的问题是闪烁的光标仍然显示在工具栏上方。 This is specifically happening in IE.这特别发生在 IE 中。 The blinking cursor comes on top.闪烁的光标出现在顶部。

Here is the sample for this issue:这是此问题的示例:

 $('.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>

Taking the focus out is not an option as there are more components in this application and this fix will not work for those situations.将焦点移出不是一种选择,因为此应用程序中有更多组件,并且此修复程序不适用于这些情况。 The fix needs to be completely autonomous.修复需要完全自主。

Just add只需添加

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

And cursor will stop blinking on IE7-IE10 (tested)光标将在 IE7-IE10 上停止闪烁(已测试)

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

UDP1 Sorry didn't see your update about 'focus' not been an option... UDP1抱歉没有看到您关于“焦点”的更新不是一个选项...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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