Before reading this article, I highly recommend reading my previous parts:
Resizable is used to set size of an element using mouse. Resizable have draggable resizer handlers. We can specify one or more handles as well as min and max width and height.
Code:
- <htmlxmlns="http://www.w3.org/1999/xhtml">
- <headrunat="server">
- <title></title>
- <script>
- $(document).ready(function()
- {
- $("#div1").resizable();
- })
- </script>
- <style>
- #div1 {
- background-color: blueviolet;
- height: 100px;
- width: 150px;
- margin-left: 50px;
- margin-top: 30px;
- font-size: 24px;
- text-align: center;
- padding-top: 50px;
- margin-left: 450px;
- margin-top: 100px;
- }
- </style>
- </head>
- <body>
- <formid="form1" runat="server">
- <div>
- <divid="div1"><span>Resize Me!</span></div>
- </div>
- </form>
- </body>
- </html>

Options
| Option | Description | Example |
| alsoResize | It define that One or more elements to resize synchronously with the resizable element. | $("#res1").resizable({ alsoResize:"#res2" }); |
| animate | Define animates to the final size after resizing. | $("#res1").resizable({ animate: true }); |
| animateDuration | Define the time in which animation will complete. This option is used only when animate option is true. By default its value is "slow". | $("#res1").resizable({ animateDuration: "slow" }); |
| animateEasing | Define which easing to apply when using the animate option. By default its value is "swing". | $("#res1").resizable({ animate:true, animateDuration: "slow", animateEasing: "easeOutBounce" }); |
| aspectRatio | Define that whether to keep the aspect (height and width) ratio for the item. By default its value is false. | $("#res1").resizable({ animate:true, aspectRatio:true }); |
| autoHide | It is used to hide the magnification icon or handles. It will appear when the mouse is over the item. By default its value is false. | $("#res1").resizable({ autoHide: true }); |
| cancel | Prevents resizing from starting on specified elements. By default its value is input, textarea, button , select , option | $("#res1").resizable({ cancel: "#text" }); |
| containment | Constrains resizing to within the bounds of the specified element or region. | $("#res1").resizable({ containment: "parent" }); |
| delay | Define time in milliseconds to start the resizing. It specified that resizing will not start until after mouse is moved beyond duration. | $("#res1").resizable({ delay:200 }); |
| disabled | Disabled the resizable by define true. | $("#res1").resizable({ disabled: true }); |
| distance | It specified that resizing will not start until after mouse is moved beyond distance. | $("#res1").resizable({ distance: 30 }); |
| ghost | Define a semi-transparent helper element is shown for resizing. | $("#res1").resizable({ ghost: true }); |
| grid | Snaps the resizing element to a grid, every x and y pixels using array [x,y] | $("#res1").resizable({ grid: [20, 10] }); |
| handles | This option is a character string indicating which sides or angles of the element can be resized. A comma delimited list of any of the following: n, e, s, w, ne, se, sw, nw, all | $("#res1").resizable({ handles: { 'ne': '#negrip', 'se': '#segrip', 'sw': '#swgrip', 'nw': '#nwgrip' } }); |
| maxHeight | The maximum height the resizable should be allowed to resize to. Default value is null. | $("#res1").resizable({ maxHeight:420 }); |
| maxWidth | The maximum width the resizable should be allowed to resize to. Default value is null. | $("#res1").resizable({ maxWidth:420 }); |
| minHeight | The minimum width the resizable should be allowed to resize to. Default value is 10. | $("#res1").resizable({ minHeight:120 }); |
| minWidth | The minimum width the resizable should be allowed to resize to. Default value is 10. | $("#res1").resizable({ minWidth:120 }); |
Methods
| Method Name | Description | Example |
| destroy | Removes the resizable functionality completely. This will return the element back to its pre-init state. | $("#res1").resizable("destroy"); |
| disable | Disable the resizable element | $("#res1").resizable("disable"); |
| enable | Enable the resizable element | $("#res1").resizable("enable"); |
| instance | Return the instance object of resizable element. If element does not have an associated instance then it will return “undefined” | $("#res1").resizable("instance"); |
| option | Return an object contain key/value pairs representing the current resizable options. | varObj_= $("#res1").resizable("option"); |
| option(optionName) | Get value of specified option | varObj_=$("#res1").resizable("option", "disabled") |
| option(optionName, Value) | Set value of specified option | $("#res1").resizable( "option", "disabled", true ); |
| widget | Return a jQuery Object | varObj_= $("#res1").resizable("widget"); |
Events
| Event | Description | Example |
| create(event, ui) | Triggered when the resizable is created | $("#res1").resizable({ create: function (event, ui) { } }); |
| resize(event, ui) | riggered triggered when the handler of resizable element is dragged. ui object contain element, helper, originalElement, originalPosition, position, size property. | T $("#res1").resizable({ resize: function (event, ui) { } }); |
| start(event,ui) | Triggered at the start of a resize operation.ui object contain element, helper, originalElement, originalPosition, position, size property. | $("#res1").resizable({ start: function (event, ui) { } }); |
| stop(event, ui) | Triggered at the end of a resize operation. ui object contain element, helper, originalElement, originalPosition, position, size property. | $("#res1").resizable({ stop: function (event, ui) { } }); |
Now we will take some examples.
Example 1






Manoj KallaPosted Jan 8, 2016, 7:12 AM
Very good article
Pankaj Kumar ChoudharyPosted Jan 7, 2016, 1:06 PM
Thanks Sir................
Debasis SahaPosted Jan 6, 2016, 11:52 PM
Good One..