可调整大小的包含对我不起作用
Resizable Containment not working for me
我是新来的,所以我不知道它是如何工作的。我正在尝试调整div的大小,但它没有正确调整父母内部的大小这是我在尝试的。你能帮帮我吗?我想在完整的父div 中调整蓝色div 的大小。我没有得到代码中缺少的内容。提前谢谢。
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<link href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>JS Bin</title>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
#Container {
position: absolute;
top: 0px;
left: 264px;
width: 312px;
height: 512px;
background-color: silver;
}
#Parent {
position: absolute;
top: 0px;
left: 0px;
width: 0px;
height: 0px;
}
#resizable {
position: absolute;
top: 0px;
left: 0px;
width: 256px;
height: 256px;
background-color: blue;
}
</style>
</head>
<body>
<div id="resizableContainer1" style="top: 6px; left: 0px; width: 256px; height: 512px; background-color: red;">
</div>
<div id="Container">
<div id="Parent">
<div id="resizable"></div>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$("#resizable").resizable({
"containment": "#Container"
});
});</script>
</html>
这个
呢:
- 从 #Parent 中删除宽度:0;和高度:0; 从
- 使 #Parent 相对
- 将包含更改为 #Parent
- 从 #resizable 中删除 CSS 位置:绝对;、左:0;和顶部:0; 删除
示例:http://jsbin.com/aDUMelI/1/edit
$("#resizable").resizable({
containment: "#Parent"
});
.css:
#Parent {
position: relative;
top: 0px;
left: 0px;
width:auto;
height:100%;
}
#resizable {
display:block;
width: 256px;
height: 256px;
background-color: blue;
}
只要去掉"containment"
中的双引号,你的母亲div 就不是#Container
,而是#Parent
你的脚本应该是,
$(document).ready(function() {
$("#resizable").resizable({
containment: "#Parent"
});
});
相关文章:
- <text区域>在我的html中包含event.keycode==13之后,wrap就不起作用了
- 谷歌地图API JS V3包含但不起作用
- php文件中包含的jquery文件在服务器上不起作用
- ng-class 在 angularJs 中由 ng-include 包含的文件内不起作用
- :包含不区分大小写的解决方案在替换文本以突出显示时不起作用
- 包含jquery的Javascript在Internet Explorer中不起作用
- Select选项包含在验证模型MVC时不起作用
- 基于屏幕大小的动态包含文件不起作用
- 选择选项包含不起作用
- 在引导选择组件中的搜索不起作用,其中数据令牌包含所有数字;4730”;
- 可调整大小的包含对我不起作用
- JS在我包含它后不起作用
- Window.open 在包含确认对话框的 if 条件中不起作用
- Execcommand justifyCenter在Firefox中不起作用,当P标签包含BR时
- 如果表包含超过 500 行,则导出到 Excel 不起作用
- 为什么JavaScript包含属性在Chrome浏览器中不起作用
- Mutilpe JS文件包含在另一个js文件中有时不起作用
- PHP 变量包含 HTML 和 JavaScript.通过JavaScript将其注入HTML不起作用
- JavaScript 包含在 PHP 中不起作用
- HTML5 canvas元素的JavaScript代码将不起作用——包含一个循环