English | 正體中文 | 简体中文

Jquery ui resize containment



范例程式码 Expand
<!-- Javascript -->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script>
    $(function(){      	
         $(".square").resizable({
             containment: "#container",
             minHeight: 70,
             minWidth: 100
        });
    });
</script>

<!-- HTML -->
<style>
    .square {
  		width:100px;
        height:100px;
        border:1px solid black;                 
        text-align:center;          		
        float:left;
        background-color:lightblue;
        cursor:pointer;
    }  
</style>
<div style="margin-bottom:10px;">Drag squre border to resize</div>
<div id="container" style="width:500px;height:250px;border:2px solid orange;float:left">
    <div class="square">jquery is a easy to use javascript library</div>          	
</div>

    
在线测试程序
© 2012 PureExample.com contact