English | 正體中文 | 简体中文

Jquery ui resize handles



范例程式码 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>
    /* handles : n, e, s, w, ne, se, sw, nw*/
    $(function () {
        $(".square").each(function () {
          $(this).html("handle : " + $(this).attr("id"));
            $(this).resizable({
                handles: $(this).attr("id")
            });
        });
    });
</script>

<!-- HTML -->
<style>
    .square {
        width:100px;
        height:100px;
        border:1px solid black;                 
        text-align:center;          		
        float:left;
        margin-left:10px;
        margin-bottom:10px;
        background-color:lightblue;        
    }  
  
    .n{
      border-top:2px solid orange
    } 
   .e{
      border-right:2px solid orange
    } 
   .s{
      border-bottom:2px solid orange
    } 
   .w{
      border-left:2px solid orange
    } 
</style>
<div id="n" class="square n "></div>
<div id="e" class="square e"></div>
<div id="s" class="square s"></div>
<div id="w" class="square w"></div>
<div id="ne" class="square n e"></div>
<div id="se" class="square s e"></div>
<div id="sw" class="square s w"></div>
<div id="nw" class="square n w"></div>

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