我有一个可调整大小的div,其内容大于其大小允许的内容。因此用户必须滚动浏览内容。当用户滚动或调整div的大小时,我需要在div内部放置一个浮动标签。
<div id="pane1" class="ui-layout-center">Top</div>
<div id="pane2" class="ui-layout-south">
<span class="my_label">My Label</span>
A lot of content
</div>
这实际上与JSFiddle上的浮动标签非常相似,但没有编辑器。我正在使用jQuery UI Layout。
如何将我的标签保存在一个地方?
以下是JSFiddle的问题:http://jsfiddle.net/getvictor/hC6jP/2/
答案 0 :(得分:1)
Fixed positioning,或通过将标签放在窗格外的绝对定位。
.my_label {
border: solid 2px #FF0000;
background: #fff;
display: block;
height: 22px;
position: fixed; // absolute -> fixed
margin-left:1em; // remove top/left positioning, and add left margin instead
// note: left is still easy to work with
}
答案 1 :(得分:0)