简体   繁体   中英

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. This is specifically happening in 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)

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

UDP1 Sorry didn't see your update about 'focus' not been an option...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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