【发布时间】:2013-04-02 04:17:32
【问题描述】:
我需要像这张图片一样制作可调整大小的手柄。
更具体地说,我需要将这些蓝点放在我的 <div> 周围,以便从不同方面调整大小。
目前我正在使用以下代码:
<html>
<head>
<link rel="stylesheet" href="jquery-ui-1.10.2/themes/base/jquery-ui.css" />
<script src="jquery-1.9.1.min.js"></script>
<script src="jquery-ui-1.10.2/ui/jquery-ui.js"></script>
<title>border</title>
<script type="text/javascript">
$(function() {
$('#elementResizable').resizable({
handles: {
'ne': '#negrip',
'se': '#segrip',
'sw': '#swgrip',
'nw': '#nwgrip'
}
});
});
</script>
<style>
#elementResizable {
border: 1px solid #000000;
width: 300px;
height: 40px;
overflow: hidden;
}
#nwgrip, #negrip, #swgrip, #segrip, #ngrip, #egrip, #sgrip, #wgrip {
width: 10px;
height: 10px;
background-color: #ffffff;
border: 1px solid #000000;
}
#segrip {
right: -5px;
bottom: -5px;
}
</style>
</head>
<body>
<div id='elementResizable'>
<h1>Full Name</h1>
Title
<div class="ui-resizable-handle ui-resizable-nw" id="nwgrip"></div>
<div class="ui-resizable-handle ui-resizable-ne" id="negrip"></div>
<div class="ui-resizable-handle ui-resizable-sw" id="swgrip"></div>
<div class="ui-resizable-handle ui-resizable-se" id="segrip"></div>
</div>
</body>
</html>
结果我得到了这样的东西。
结果还可以,但是我需要把手柄不仅在角落,还要在边框的中间,就像第一张图片一样。
【问题讨论】:
-
为什么不使用 's,n,e,w' 坐标呢?
-
我试过了,但它对我不起作用。请在此处查看代码jsfiddle.net/j2JU6/255 或在此处查看结果图像imageshack.us/a/img577/2481/57414673.jpg
标签: javascript jquery jquery-ui resizable handles