我想使用 jQueryUI 的 draggable 将表格行拖到固定的导航栏上。被拖动的元素具有 css 属性:
element.style {
position: absolute;
z-index: 200;
}
固定导航栏有属性
#player {
position: fixed;
opacity: 1;
z-index: 100;
}
即使可拖动元素的 z-index 更高,它仍然不会出现在固定导航栏的前面。在 HTML 中的 position:fixed
元素前面获取 position:absolute
元素是不可能的吗?
最佳答案
http://jsbin.com/eWoNASE/1/edit
如果没有实际示例,很难调试您的问题,但这对我有用:
<div id="wrap">
<div id="fixed">
<p>hi</p>
</div>
<div id="draggable">
<p>Drag me around</p>
</div>
</div>
CSS:
#wrap { position: relative; }
#fixed {
position: fixed;
opacity: 1;
z-index: 100;
}
#draggable {
background-color: red;
position: absolute;
opacity: 1;
z-index: 200;
}
关于jQuery UI 可在固定元素上拖动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19416495/