jquery ui 的 resizable 如何限制子.col不超出父.box?
时间:2010-05-30
来源:互联网
jquery ui 的 resizable 如何限制子.col不超出父.box?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js"></script> <script type="text/javascript"> function my_resizable(){ $(".col").resizable({ handles:"e" }); } $(function(){ my_resizable(); }); </script> <link href="http://jqueryui.com/themes/base/jquery.ui.resizable.css" type="text/css" rel="stylesheet"/> <style type="text/css"> .box{wdith:500px;height:200px;border:1px solid black;} .col{width:60px;height:100%;background-color:tan;float:left;border:1px solid red;} </style> <div class="box"> <div class="col"></div> <div class="col"></div> </div>
提示:您可以先修改部分代码再运行
当向左拉.col时,如果两个.col的宽度加起来大于.box就换行了,如何限制.col的宽度让.col最大只能拉到.box的边缘?
提示:您可以先修改部分代码再运行
复制内容到剪贴板
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js"></script>
<script type="text/javascript">
function my_resizable(){
$(".col").resizable({
handles:"e"
});
}
$(function(){
my_resizable();
});
</script>
<link href="http://jqueryui.com/themes/base/jquery.ui.resizable.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
.box{wdith:500px;height:200px;border:1px solid black;}
.col{width:60px;height:100%;background-color:tan;float:left;border:1px solid red;}
</style>
<div class="box">
<div class="col"></div>
<div class="col"></div>
</div>
代码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js"></script>
<script type="text/javascript">
function my_resizable(){
$(".col").resizable({
handles:"e"
});
}
$(function(){
my_resizable();
});
</script>
<link href="http://jqueryui.com/themes/base/jquery.ui.resizable.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
.box{wdith:500px;height:200px;border:1px solid black;}
.col{width:60px;height:100%;background-color:tan;float:left;border:1px solid red;}
</style>
<div class="box">
<div class="col"></div>
<div class="col"></div>
</div>
作者: linjuming 发布时间: 2010-05-30
function my_resizable(){
$(".col").resizable({
handles:"e",
maxWidth: 250
});
}
限制最大宽度试试
$(".col").resizable({
handles:"e",
maxWidth: 250
});
}
限制最大宽度试试
作者: xyq159589 发布时间: 2010-05-30
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28