jQuery 1.4.2 可调整大小的 div 一旦适合浏览器窗口就停止工作
我有一个通过 jQuery UI 调整大小的“工具栏”div。
奇怪的是,我无法拖动 div 除非 div 太长以至于超出了可视页面,从而出现了滚动条。然后我可以将 div 拖到我喜欢的任何地方。但是,如果我拖动 div 使其适合没有滚动条的页面,然后将其放下,则无法再次调整其大小(除非我使页面变小,以便滚动条再次出现!)。
这是 html:
<div class="Viewer">
<div align="center">
<div align="left" style="position:relative; width:100%; height:30px;">
<div id="toolbar_buttons" class="ToolBar">
<table>
<tr>
<td>
<button id="play">play</button>
</td>
<td>
<button id="stop">stop</button>
</td>
<td>
<div id="slider-vertical"></div>
</td>
<td style="width:30px;">
<!--<input type="text" id="amount" style="border:0; display:none; font-weight:bold;" />-->
<span id="amount"></span>
</td>
<td>
<button id="btnScreenSizer">fit to screen</button>
</td>
<td>
<div id="status">status stuff goes here</div>
</td>
</tr>
</table>
</div>
<div id="toolbar" class="ui-widget-header"></div>
</div>
</div>
</div>
这是 CSS:
#toolbar
{
display: none;
width: 300px;
height: 45px;
z-index: -999999;
}
这是 jQuery:
$("#toolbar").resizable({
handles: "se",
maxHeight: 45,
minHeight: 45,
minWidth: 400
});
有什么想法吗?工具栏位于 iFrame 中。
I have a 'toolbar' div that I made resizable via jQuery UI.
The weird thing is, I cannot drag the div unless the div is so long it extends past the viewable page, making the scrollbars appear. I can then drag the div anywhere I like. However, if I drag the div so it fits in the page without scrollbars, and I drop, I cannot resize it again (unless I make the page smaller so the scrollbars appear again!).
Here's the html:
<div class="Viewer">
<div align="center">
<div align="left" style="position:relative; width:100%; height:30px;">
<div id="toolbar_buttons" class="ToolBar">
<table>
<tr>
<td>
<button id="play">play</button>
</td>
<td>
<button id="stop">stop</button>
</td>
<td>
<div id="slider-vertical"></div>
</td>
<td style="width:30px;">
<!--<input type="text" id="amount" style="border:0; display:none; font-weight:bold;" />-->
<span id="amount"></span>
</td>
<td>
<button id="btnScreenSizer">fit to screen</button>
</td>
<td>
<div id="status">status stuff goes here</div>
</td>
</tr>
</table>
</div>
<div id="toolbar" class="ui-widget-header"></div>
</div>
</div>
</div>
Here's the CSS:
#toolbar
{
display: none;
width: 300px;
height: 45px;
z-index: -999999;
}
Here's the jQuery:
$("#toolbar").resizable({
handles: "se",
maxHeight: 45,
minHeight: 45,
minWidth: 400
});
Any ideas? The toolbar is located in an iFrame.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定问题到底是什么,但我解决了遇到的问题。
我删除了 id='toolbar' 的 div 并将 ui-widget-header 类添加到 'toolbar_buttons' div,如下所示:
现在我可以随时拖动。
I'm not sure what the problem was exactly but I fixed the issue I was having.
I removed the div with id='toolbar' and added the ui-widget-header class to the 'toolbar_buttons' div, like so:
Now I can drag any time.