1:尺寸调整组件(Resizable)组件可以使选定的DOM元素变成可调整尺寸的对象,即可以通过拖动调整手柄来改变其尺寸大小。
$(“.selector”).resizeable(options);
简单实例:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>resizable组件</title>
<script language=”javascript” src=”js/jquery-1.4.2.min.js”></script>
<script type=”text/javascript” src=”js/jquery.ui.core.js”></script>
<script type=”text/javascript” src=”js/jquery.ui.widget.js”></script>
<script type=”text/javascript” src=”js/jquery.ui.mouse.js”></script>
<script type=”text/javascript” src=”js/jquery.ui.resizable.js”></script>
<style type=”text/css”>
body {
font-size:14px;
}
#wrap {
clear:both;
margin: 10px auto 10px auto;
width: 287px;
height:164px;
border: 1px solid #BFBFBF;
background-color: #fff;
background-image: url(images/40.JPG);
}
h1 {
color:#006;
font-size:24px;
font-weight:bold;
text-align:center;
margin-top:0px;
}
.drag {
width:140px;
height:100px;
border: 1px solid #000;
float:left;
margin:20px 0 0 20px;
background:#FFF;
}
img {
width:200px;
border:1px solid #D6D6D6;
padding:4px;
margin:2px;
}
</style>
<link href=”CSS/base/jquery.ui.all.css” rel=”stylesheet” type=”text/css” />
<script type=”text/javascript” language=”javascript”>
$(document).ready(function(){
$(“#car”).resizable();
});
</script>
</head>
<body>
<img src=”images/happy.gif” id=”car” />
</body>
</html>
效果图:
其实,在调用resizable()方法之后,将会在目标对象的右边框、下边框和右下角分别添加div元素,并对div元素依次添加ui-resizable-e, ui-resizable-s, ui-resizable-se类,从而形成拖动手柄
2:延迟调整
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>










