我正在制作一个编辑器,它会在选中文本时显示工具栏。在IE浏览器中遇到的问题是闪烁光标仍然出现在工具栏上方,这个问题只出现在IE浏览器中。
$('.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>
把焦点移开不是一个选项,因为这个应用程序中有更多的组件,这个修复措施对于那些情况是无效的。这个修复方案需要完全自主。