1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <title>jQuery UI Resizable - Constrain resize area</title>
|
---|
5 | <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
|
---|
6 | <script type="text/javascript" src="../../jquery-1.4.1.js"></script>
|
---|
7 | <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
---|
8 | <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
---|
9 | <script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
---|
10 | <script type="text/javascript" src="../../ui/jquery.ui.resizable.js"></script>
|
---|
11 | <link type="text/css" href="../demos.css" rel="stylesheet" />
|
---|
12 | <style type="text/css">
|
---|
13 | #container { width: 300px; height: 300px; }
|
---|
14 | #container h3 { text-align: center; margin: 0; margin-bottom: 10px; }
|
---|
15 | #resizable { background-position: top left; width: 150px; height: 150px; }
|
---|
16 | #resizable, #container { padding: 0.5em; }
|
---|
17 | </style>
|
---|
18 | <script type="text/javascript">
|
---|
19 | $(function() {
|
---|
20 | $("#resizable").resizable({
|
---|
21 | containment: '#container'
|
---|
22 | });
|
---|
23 | });
|
---|
24 | </script>
|
---|
25 | </head>
|
---|
26 | <body>
|
---|
27 | <div class="demo">
|
---|
28 |
|
---|
29 | <div id="container" class="ui-widget-content">
|
---|
30 | <h3 class="ui-widget-header">Containment</h3>
|
---|
31 | <div id="resizable" class="ui-state-active">
|
---|
32 | <h3 class="ui-widget-header">Resizable</h3>
|
---|
33 | </div>
|
---|
34 | </div>
|
---|
35 |
|
---|
36 | </div><!-- End demo -->
|
---|
37 |
|
---|
38 | <div class="demo-description">
|
---|
39 |
|
---|
40 | <p>Define the boundaries of the resizable area. Use the <code>containment</code> option to specify a parent DOM element or a jQuery selector, like 'document.'</p>
|
---|
41 |
|
---|
42 | </div><!-- End demo-description -->
|
---|
43 | </body>
|
---|
44 | </html>
|
---|