jQuery Plugin To Generate Resizable DOM Elements - Resizable

File Size: 32.6 KB
Views Total: 6376
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Plugin To Generate Resizable DOM Elements - Resizable

Resizable is a very small and touch-enabled jQuery plugin for creating resizable DOM elements with custom drag/resize handles.

It supports both mouse drag and touch swipe events and is useful for responsive design that helps front-end developers demonstrate how the web components work on different screen sizes / platforms without having to resize the browser window.

How to use it:

1. To get started, you need to load the jQuery resizable plugin after loading jQuery library as follow.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="src/jquery-resizable.js"></script> 

2. Call the function on target DOM element to make it resizable.


3. Customize the plugin with the following options.


  // selector for handle that starts dragging
  handleSelector: null,

  // resize the width
  resizeWidth: true,

  // resize the height
  resizeHeight: true,    

  // the side that the width resizing is relative to
  resizeWidthFrom: 'right',

  // the side that the height resizing is relative to
  resizeHeightFrom: 'bottom',     

  // disable touch-action on $handle
  // prevents browser level actions like forward back gestures
  touchActionNone: true,

  // instance id
  instanceId: null


4. Callback functions.


  onDragStart: function (e, $el, opt) {
    $el.css("cursor", "nwse-resize");
  onDragEnd: function (e, $el, opt) {
    $el.css("cursor", "");

  onDrag: function (e, $el, newWidth, newHeight, opt) {
    // limit box size
    if (newWidth > 300)
      newWidth = 300;
    if (newHeight > 200)
      newHeight = 200;        


    // explicitly return **false** if you don't want 
    // auto-height computation to occur
    return false;


5. It also provides a method to resize table columns via drag and drop:

<script src="src/jquery-resizableTableColumns.min.js"></script> 
.resizer {
  position: absolute;
  top: 0;
  right: -8px;
  bottom: 0;
  left: auto;
  width: 16px;    
  cursor: col-resize;       



  • v0.35: At Watch scripts using LiveReload Server (dotnetcore sdk required); Add .resizableSafe() to allow side by side operation with jquery UI or other framework. Update jquery dependency to ^3.4.0 to avoid security nag.


  • v0.32: Fix resizing for content that contains iFrame by removing pointer events on iFrame on drag and restoring and ondragcomplete.


  • v0.27: Fix - remove console.log from dev code.


  • v0.25: Update code for jQuery 3.x


  • v0.17: Allow a child selector for the handle


  • v0.15


  • Add jquery-resizableTableColumns plug-in


  • Add touch-action override on body to facilitate dragging in Internet Explorer with touch.

This awesome jQuery plugin is developed by RickStrahl. For more Advanced Usages, please check the demo page or visit the official website.