可叠加元素被叠加div阻止

时间:2015-01-21 15:01:36

标签: javascript jquery css html5

我要求在可滚动的[pre]元素上方放置一个重叠div(z顺序)。问题是,我无法再在pre元素内滚动,因为叠加层会阻止它。

问:有没有办法通过div传递滚动事件,以便它们到达底层元素?

CSS:

.dropzone {

    pointer-events:none;
}

#myimage {

    float: left;
    border-width: 0px; 
    border-style: none; 
    background-color:none;
    padding: 0px;
    position: relative;
}


#myoverlay {

    position: absolute;
    background-color:#139C8A;
    background-image: url('../images/drag-icon-white.png');
    background-size: 160px 66px;
    background-repeat: no-repeat;
    background-position: center;
    opacity:0.0;
    z-index:-1;
}

#myresponse {

    float: right;
    border-width: 0px; 
    border-style: none; 
    background-color:none;
    padding: 0px;
    position: relative;
}

 .mycode {

    text-align:left;
    color:#EFEFEF;
    background-color:#3C3C48;
    border-width: 0px; 
    border-style: none;
    overflow-y: scroll; 
    position: relative;

}

HTML:

<div class="container">
  <div id="myoverlay">&nbsp;</div>
  <div class="row">
        <div class="col-md-12">
          <div id="myimage">
            <canvas id="myCanvas" width="970" height="485"></canvas>
          </div> <!-- end col-md-4 -->
          <div id="myresponse">
            <pre id="mycode" class="mycode">
              <span style="color:#139C8A"><i>(Response will appear here)</i></span>
            </pre>
          </div>
          <div id="dropzone" class="dropzone-detect detect-droppable"></div>
        </div>
  </div><!-- end row -->
</div> <!-- /container -->

1 个答案:

答案 0 :(得分:0)

您已将CSS分配给班级.dropzone。但是没有dropzone级别,只是一个ID!尝试以下CSS:

#dropzone { pointer-events:none; }

但请注意,this isn't working in IE below version 11。对于这些浏览器,您可以使用polyfill