1

我一直在寻找我们可以处理光标在其他 div 上闪烁的任何方法。为了让我的陈述清楚,我添加了一个屏幕截图 -IE中的屏幕截图

  1. 灰色 div 是位于顶部的固定位置 div,用于创建功能区。
  2. 左边有边框的白色区域实际上是一个属性为 contentEditable="true" 的 div,它是可编辑区域。Imp- 可编辑区域的高度可以随着内容而增加,即我们不能在那里有滚动条。

因此,当内容超出屏幕并且我们向下滚动时,如果光标已放置在可编辑区域内,它会出现在功能区上方。

如果选择了图像上可调整大小的边框,也会发生同样的情况。而且,这仅适用于 IE。Firefox 和 chrome 没有问题。

代码如下:

<head runat="server">
<title></title>
<style type="text/css">
    .wrapper {
        width:960px;
        height:auto;
        min-height:600px;
        margin-left:auto;
        margin-right:auto;
        border-left:1px solid #cfcfcf;
        border-right:1px solid #cfcfcf;
        box-shadow:0px 10px 10px #6f6f6f;
        background-color:#ffffff;
        margin-top:100px;
    }
    .container {
        width:100%;
        height:auto;
        min-height:800px;
        padding:10px;
        font-family:Arial;
        border:1px solid #3f3f3f;
        box-sizing:border-box;
        -moz-box-sizing:border-box;
        -webkit-box-sizing:border-box;
    }
    .editor-ribbon {
        height:100px;
        position:fixed;
        left:0px;
        top:0px;
        width:100%;
        border-bottom:1px solid #cfcfcf;
        width:100%;
        background-color: #ffffff;
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#f1f1f1', endColorstr = '#e3e3e3');
        -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr = '#f1f1f1', endColorstr = '#e3e3e3')";
        background-image: -moz-linear-gradient(top, #f1f1f1, #e3e3e3);
        background-image: -ms-linear-gradient(top, #f1f1f1, #e3e3e3);
        background-image: -o-linear-gradient(top, #f1f1f1, #e3e3e3);
        background-image: -webkit-gradient(linear, center top, center bottom, from(#f1f1f1), to(#e3e3e3));
        background-image: -webkit-linear-gradient(top, #f1f1f1, #e3e3e3);
        background-image: linear-gradient(top, #f1f1f1, #e3e3e3);
    }
</style>
</head>
<body>
  <form id="form1" runat="server">
    <div class="editor-ribbon"></div>
    <div class="wrapper">
        <div class="container" contenteditable="true">

        </div> 
    </div>
  </form>
</body>
4

3 回答 3

1

在我看来,您的答案是:不会很快修复

https://connect.microsoft.com/IE/feedback/details/841043/blinking-text-cursor-overlapping-with-div

闪烁的文本光标与 div 重叠

状态:关闭为推迟

描述

输入的文本光标在重叠的 div 上变得可见。文本光标不应该变得可见,而是停留在重叠的 div 下方,因为整个输入(或可编辑的文本区域)都停留在该 div 下方。

于 2016-11-08T08:11:41.280 回答
0

该问题与色带的背景过滤器/图像属性有关。

将背景更改为简单的颜色可以解决问题。

http://jsfiddle.net/4drs2/6/

  .editor-ribbon {
    height:100px;
    position:fixed;
    left:0px;
    top:0px;
    width:100%;
    border-bottom:1px solid #cfcfcf;
    width:100%;
    background-color: gray;
        }
于 2013-06-13T12:28:22.023 回答
0

我遇到了同样的问题,我解决的方法是向blur()所涉及的输入添加函数,这意味着每次用户滚动文档时都会触发 blur() 函数。

缺点
当用户滚动时输入失去焦点。

于 2018-01-10T16:01:29.707 回答