Resizable handles with jQueryUI

后端 未结 1 1481
[愿得一人]
[愿得一人] 2020-12-28 16:59

I need to make resizable handles like in this image.

\"green

To be more sp

相关标签:
1条回答
  • 2020-12-28 18:03

    Take a look at this fiddle: http://jsfiddle.net/j2JU6/256/

    HTML:

    <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 class="ui-resizable-handle ui-resizable-n" id="ngrip"></div>
        <div class="ui-resizable-handle ui-resizable-s" id="sgrip"></div>
        <div class="ui-resizable-handle ui-resizable-e" id="egrip"></div>
        <div class="ui-resizable-handle ui-resizable-w" id="wgrip"></div>
    </div>
    

    CSS:

    #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;
    }
    #nwgrip {
        left: -5px;
        top: -5px;
    }
    #negrip{
         top: -5px;
         right: -5px;
    }
    #swgrip{
        bottom: -5px;
        left: -5px;
    }
    #segrip{
         bottom: -5px;
        right:-5px;
    }
    #ngrip{
         top: -5px;
        left:50%;
    }
    #sgrip{
         bottom: -5px;
        left: 50%;
    }
    #wgrip{
         left:-5px;
         top:50%;
    }
    #egrip{
         right:-5px;
         top:50%;
    }
    

    JavaScript:

    $('#elementResizable').resizable({
        handles: {
            'nw': '#nwgrip',
            'ne': '#negrip',
            'sw': '#swgrip',
            'se': '#segrip',
            'n': '#ngrip',
            'e': '#egrip',
            's': '#sgrip',
            'w': '#wgrip'
        }
    });
    
    0 讨论(0)
提交回复
热议问题