Skip to content

Instantly share code, notes, and snippets.

@amelieykw
Created April 12, 2018 12:06
Show Gist options
  • Save amelieykw/c427ff8aae9dd9a9f5c81bd3754bffb1 to your computer and use it in GitHub Desktop.
Save amelieykw/c427ff8aae9dd9a9f5c81bd3754bffb1 to your computer and use it in GitHub Desktop.
[jQuery - Resizable] #jQuery #Resizable

Change the size of an element using the mouse.

Demo

Enable any DOM element to be resizable.

With the cursor grab the right or bottom border and drag to the desired width or height.

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>jQuery UI Resizable - Default functionality</title>
    
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="/resources/demos/style.css">
    
    <style>
    #resizable { width: 150px; height: 150px; padding: 0.5em; }
    #resizable h3 { text-align: center; margin: 0; }
    </style>
    
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    <script>
    $( function() {
      $( "#resizable" ).resizable();
    } );
    </script>
</head>
<body>
  <div id="resizable" class="ui-widget-content">
      <h3 class="ui-widget-header">Resizable</h3>
  </div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment