我有一个可调整大小的区域,其中包含两个我也想并排调整大小的区域。每个区域的水平增长比例为 1:1,但由于两个包含的区域并排,因此它们的宽度之和的增长速度是其容器的两倍。如何将两个包含区域的水平增长减半。
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css" type="text/css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
</head>
<body>
<style>
#resizable { background-position: top left; }
#resizable { width: 300px; height: 120px; padding: 0.5em; }
#also1, #also2 { width: 75px; height: 60px; padding: 0.5em; }
#resizable h3, #also1 h3 , #also2 h3 { text-align: center; margin: 0; }
#also1, #also2 { margin-top: 1em; }
</style>
<script>
$(function() {
$( "#resizable" ).resizable({
alsoResize: "#also1,#also2"
});
});
</script>
<div id="resizable" class="ui-widget-header">
<h3 class="ui-state-active">Resize</h3>
<table>
<tr>
<td>
<div id="also1" class="ui-widget-content">
<h3 class="ui-widget-header">also one</h3>
</div>
</td>
<td>
<div id="also2" class="ui-widget-content">
<h3 class="ui-widget-header">also two</h3>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>