【问题标题】:Jquery UI draggable element from fixed div hidden by absolute element来自被绝对元素隐藏的固定 div 的 Jquery UI 可拖动元素
【发布时间】:2014-01-08 15:30:08
【问题描述】:

我正在使用 Jquery UI 来拖动一个 div。此 div 位于另一个位置固定的元素内。当我将元素拖动到具有绝对位置的另一个 div 上时,拖动的元素被隐藏。

http://jsfiddle.net/sGCWZ/

HTML

<div style="position: fixed">
    <div id="drag">Drag Me</div>
</div>
<div id="drop">Move here</div>

JS

$(function () {
    $("#drag").draggable({ 
    });
});

CSS

#drop{
    position: absolute;
    height: 200px;
    width: 200px;
    background: #999;
}

#drag{
    height: 200px;
    width: 200px;
    background: #F00;
    z-index: 100;
    margin-left: 250px;
}

如何让拖动的 div 保持在绝对 div 之上?

【问题讨论】:

  • 这似乎不会发生在 FF 26 上。

标签: jquery css jquery-ui jquery-ui-draggable


【解决方案1】:

我为固定元素添加了高 z-index。

 <div style="position:fixed; z-index:1000000;">
   <!-- code -->
 </div>

JSFiddle

【讨论】:

  • 天啊,我什么都试过了,但不是这个!我感到很困惑。但是谢谢它现在可以工作了......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-27
  • 2015-01-23
  • 1970-01-01
  • 2023-03-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多