• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small jQuery plug-in to make DOM components resizable

jquery-resizable

A small jQuery plug-in to make HTML DOM elements resizable

This small, self-contained jQuery plug-in allows you to make DOM elements resizable using a sizing handle. It works with Mouse and Touch events so you can resize elements on mobile devices.

Resizables are useful if you want to add resizing features to your HTML layouts for things like like resizable dialogs, splitter panes or elements that can be resized by a user in a layout.

Samples on CodePen

There's a more info on the how's and why's in this blog post:

Installation

You can install jquery-resizable from NPM. Please note that the name is jquery-resizable-dom due to another component name conflict.

npm install jquery-resizable-dom

Usage

Global Scope:

$(selector).resizable(options);

Naming Conflict Version: .resizableSafe()

If you're using jQuery-resizable with another component that uses the same name - like jquery ui - you can use .resizableSafe() instead of .resizable() with the same syntax. This allows side by side operation with conflicting libraries.

$(selector).resizableSafe(options);

If you need this feature, just replace any references to .resizable() to .resizableSafe().

Module Loading

jquery-resizable supports commonJs and AMD module loading for the jQuery dependency. Since this is a plug-in there are no exports but resizable is just an extension method on the jQuery.fn extension object.

To use this plug-in add a script reference to jQuery and the resizable plug-in. Then use a jQuery selector to select the element to resize and provide an additional .handleSelector to select the sizing handle which initiates the resize operation.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" type="text/javascript"></script>
<script src="../src/jquery-resizable.js"></script>
<script src="../src/jquery-resizableTableColumns.js"></script>
<script>
$("#box").resizable({ 
    handleSelector: ".splitter",
    resizeHeight: false
});   
</script>

Options

The options parameter can be a map of any of these properties (default values are shown):

var opt = {
    // optional 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',            
    // hook into start drag operation (event,$el,opt passed - return false to abort drag)    
    onDragStart: null,
    // hook into stop drag operation (event,$el,opt passed)
    onDragEnd: null,
    // hook into each drag operation (event,$el,opt passed)
    onDrag: null
    // disable touch-action on the $handle
    // prevents browser level actions like forward back gestures
    touchActionNone: true
};

handleSelector
A jQuery selector or DOM element that acts as a selector. This can be a string, a DOM object or an existing jQuery selector.

If no selector is passed the element itself becomes resizable. Usually this results in undesirable behavior but you can limit the drag start location using the onDragStart handler.

If the selector is prepended by a > the element is searched inside the resized component.

<!-- first instance -->
<div class="box">
  <div class="handle">
  </div>
</div>

<!-- second instance -->
<div class="box">
  <div class="handle">
  </div>
</div>

<script>
$(".box").resizable({
  handleSelector: "> .handle"
});
</script>

resizeWidth, resizeHeight
These two boolean values determine whether the width or height are resizable. Both are true by default so disable which ever dimension you don't want to resize.

resizeWidthFrom,resizeHeightFrom Determines which direction the reszing is done from. By default the directions are "right" and "bottom" but they could be "left" and "top". Useful for RTL locales where drag operations are naturally opposite to LTR.

onDragStart
Hook method fired just before you start dragging. You can return an explicit false value to abort the drag operation. Gets passed the event, the selected jQuery element and the options object.

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

onDrag
Hook method fired whenever the mouse cursor moves.

Receives jQuery event, jquery selected element, newWidth, newHeight and the options object. Optionally return an explicit value of false to indicate you don't want to set the newWidth, newHeight values after ondrag completes.

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

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

onDragEnd
Hook event fired when the drag operation completes and the mouse is released. Receives event, jquery selected element and the options object.

touchActionNone
Sets touch-action: none on the handle element to prevent browser interference to initiating touch drag operations especially on Internet Explorer, Edge and Windows 10 browsers.

Commands

destroy

Should the need arise, you can remove a resizable instance with:

  $el.resizable('destroy');

jquery-resizableTableColumns Plugin

Usage

$(selector).resizableTableColumns(options);

The options are the same as for the .resizable plug-in. The only parameter you likely will override though is .resizeHeight which is defaulted to false.

To use this plug-in add a script reference to jQuery and the resizable and resizableTableColumns plug-in. Then use a jQuery selector to select columns and headers you want to resize. You also need to provide the CSS for the .resizer class shown below.

<style>
    /*
        this is important!
        make sure you define this here
        or in jQuery codef
    */
    .resizer {
        position: absolute;
        top: 0;
        right: -8px;
        bottom: 0;
        left: auto;
        width: 16px;    
        cursor: col-resize;       
    }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" type="text/javascript"></script>
<script src="../src/jquery-resizable.js"></script>
<script src="../src/jquery-resizableTableColumns.js"></script>
<script>
    $("td,th").resizableTableColumns();
    //$("td:first-child,td:nth-child(2),td:nth-child(3)").resizableTableColumns();
</script>

For more info on this plug-in please see the jQuery-resizable and Table Column Resizing Blog post that describes this plug-in in more detail.

License

Licensed under the MIT License. There's no charge to use, integrate or modify the code for this project. You are free to use it in personal, commercial, government and any other type of application.

All source code is copyright © Rick Strahl, West Wind Technologies, regardless of changes made to them. Any source code modifications must leave the original copyright code headers intact.

Warranty Disclaimer: No Warranty!

IN NO EVENT SHALL THE AUTHOR, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AND DOCUMENTATION, BE LIABLE FOR ANY COMMERCIAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS, EVEN IF YOU OR OTHER PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Change Log

Version 0.35

  • **Add .resizableSafe() to allow side by side w/ jquery.ui** Added .resizableSafeoverload to allow loading resizable in scenarios where another jquery component call.resizable()is in use. Most commonly this might be jquery UI. This is useful for other components that might depend on this particular component as a dependency and if they do they should use.resizableSafe()`. Syntax is otherwise identical.

Version 0.32

  • Fix iFrame Drag Jitter
    Added logic to remove iFrame pointer events on drag start and restore on drag end which removes issue with extreme drag on any resized panel that contains an iframe.

Version 0.28

  • Small Bug Fixes
    Remove console.log commands. Clean up code and add additional source comments.

  • Typescript definition added
    Added typescript definition.

Version 0.25

  • Destroy Option to release resizables
    Added support removing resizables using $(el).resizable('destroy').

  • Fix Touch Sizing Code
    Fix up end drag detection both for mouse and touch dragging operations for more reliable end-drag detection. Fixes issue where the drag cursor previously would loose connection to the drag handle and continue to drag after releasing.

  • Support for jQuery 3.x
    Fixed a few issues related to running under jQuery 3.x. Switched to .on() and .off() handlers for all event handlers.

Version 0.20

  • Module Loader Support for jQuery
    jquery-sizable can now use commonJs and AMD to load the jQuery dependency. Thanks Thiago Delgado Pinto for adding.

Version 0.18

  • onDrag Behavior Updated to support opting out of move operation
    Added additional logic to onDrag processing so that when false is returned the auto-resizing of the container is not applied. This allows you to take over the width calculation yourself for things like limiting resize size. (changes by ohcibi)

Version 0.17

  • Allow automated child selectors using > syntax in handle selector
    You can now specify > to select child elements inside of the container. Added to simplify referencing contained elements generically without having to explicitly specify the resized container.

Version 0.15

  • Add resizeWidthFrom and resizeHeightFrom Options
    These options are useful in RTL environments where drag resizing operations are performed from the left edge of components. You can specify the source edge for resizing operations.

Version 0.14

  • Add jquery-resizableTableColumns Plugin
    Added a small wrapper plugin that allows resizing of table columns and headers.

Version 0.13

  • Fix Touch Support in IE and Edge
    Added touch-action:none logic to the drag handle to avoid drag initiation issues in IE and Edge which won't fire touchStart events when the document has touch gestures enabled.

Version 0.11

  • **initial release **

More Repositories

1

MarkdownMonster

An extensible Markdown Editor, Viewer and Weblog Publisher for Windows
HTML
1,584
star
2

Westwind.Globalization

Database driven resource localization for .NET applications
C#
543
star
3

AlbumViewerVNext

West Wind Album Viewer ASP.NET Core and Angular Sample
JavaScript
505
star
4

Westwind.AspnetCore.LiveReload

ASP.NET Core Live Reload Middleware that monitors file changes in your project and automatically reloads the browser's active page
C#
470
star
5

WestWindWebSurge

Quick and easy URL and Load Testing for your Web applications on Windows
388
star
6

WestwindToolkit

A utility toolkit for .NET development from Core to Web
C#
273
star
7

Westwind.Utilities

A general purpose utility and helper library for .NET development
C#
255
star
8

Westwind.AspNetCore.Markdown

An ASP.NET Core Markdown support library that provides Markdown parsing, a Markdown TagHelper and Markdown Page Handler Middleware
C#
248
star
9

Westwind.Scripting

Small C# library to provide dynamic runtime code compilation from source code for code and expressions execution
C#
205
star
10

Westwind.ApplicationConfiguration

Strongly typed, code-first configuration classes for .NET applications
C#
178
star
11

Westwind.RazorHosting

Hosting the Razor Runtime outside of ASP.NET/MVC for use in non-Web .NET applications.
C#
144
star
12

jquery-watch

A jQuery plug-in to watch CSS style and attribute changes and get notified when a change occurs
JavaScript
133
star
13

SetResolution

Quickly set Windows Display Resolution via Command Line
C#
128
star
14

Westwind.AspNetCore

ASP.NET Core Helpers and Utilities
C#
126
star
15

Expando

Extensible dynamic types for .NET
C#
108
star
16

LiveReloadServer

A self-contained, local, cross-platform, static file Web Server based on .NET with automatic Live Reloading, Markdown rendering and loose Razor Pages support.
CSS
100
star
17

json.date-extensions

Date parsing extensions for the JavaScript JSON parser to provide real dates from JSON.parse()
JavaScript
93
star
18

wwDotnetBridge

.NET Interop for Visual FoxPro made easy
C#
73
star
19

AspNetWebApiArticle

Source code for ASP.NET WebApi Article for Code Magazine
JavaScript
66
star
20

DeleteFiles

Windows Console Utility to delete files and folders recursively with optional date filtering
C#
62
star
21

CodePaste.NET

CodePaste.NET site code
JavaScript
58
star
22

highlightjs-badge

Addon component to highlightjs that lets you copy code snippets to the clipboard and displays the active syntax
CSS
46
star
23

HtmlSanitizer

A base Html Sanitizer for .NET
C#
35
star
24

Westwind.HtmlPackager

A small utility class used to package HTML content into a self contained HTML document both as a single file, or a folder with all dependencies copied to local.
C#
35
star
25

AspNetFrameworksPerformance

ASP.NET Raw Throughput Performance Post Sample
C#
31
star
26

AspNetCoreRawRequestSample

Sample code for Accepting Raw Request Body in Asp.NET Core Applications
C#
31
star
27

CordovaAlbumViewer

Sample code for "Taming Mobile Apps with Cordova and Visual Studio" CODE magazine article
JavaScript
30
star
28

Westwind.plUploadHandler

An ASP.NET base HttpHandler library to handle plUpload content on the server.
JavaScript
28
star
29

wwMongoDb

Access MongoDb from Visual FoxPro
xBase
25
star
30

WestWind.WebView.HtmlToPdf

Creating Pdf output from Html with .NET on Windows using the WebView2 control
HTML
25
star
31

Westwind.Wpf.Statusbar

A small WPF library to provide animated status bar operations
C#
24
star
32

VisualStudioSnippetConverter

Utility to convert Visual Studio Code Snippets to VS Code and Rider.
C#
22
star
33

vue-mover

A 2 list mover component implemented as a VueJs Component
JavaScript
19
star
34

Westwind.Web.Markdown

Markdown support for ASP.NET WebForms and MVC applications
C#
19
star
35

DotnetDesktopRuntimeInstaller

A tiny Windows console executable that can be distributed with an application and called from an installer to download and install the .NET runtime.
C#
18
star
36

GistIntegration-MarkdownMonster-Addin

Markdown Monster addin to create embeddable Gists for Markdown documents, and to load and save documents from Gists.
C#
17
star
37

Westwind.QueueMessageManager

.NET Library to provide a simple, two-way messaging queue for enabling offloading of long running operations to other processes/machines.
JavaScript
16
star
38

Westwind.WebView

A .NET support library for the `Microsoft.Web.WebView2` control to aid with common operations and .NET / JavaScript interop.
HTML
14
star
39

AspNetCoreFromScratchSample

Working example to experiment with building Asp.net core from scratch
C#
14
star
40

SignalrChatSample

Sample SignalR Chat application that demonstrates VueJs, Angular, FoxPro and .NET clients to SignalR
JavaScript
12
star
41

Westwind.AspNetCore.HostedWebServer

Sample that demonstrates how to create a minmal ASP.NET Web Server that can be hosted in a desktop (or other non-Web) application easily.
C#
12
star
42

Westwind.Data.EfCore

Lightweight Business Object wrapper for Entity framework that handles CRUD operations and error handling.
C#
12
star
43

BlogPosts

HTML
11
star
44

MarkdownMonsterAddinsRegistry

Markdown Monster Addin Registry
10
star
45

Pandoc-MarkdownMonster-Addin

A Pandoc Markdown Parser and Pandoc Operations Library for Markdown Monster
C#
10
star
46

Commander-MarkdownMonster-Addin

Commander C# Scripting Addin that can be used to automate simple tasks in Markdown Monster without creating an Addin. Launch external tools, update documents or mail merge content into the editor.
C#
10
star
47

WpfWebView2Playground

JavaScript
9
star
48

DI2017-AspNet-Core-Angular

Session Materials for Dev Intersection ASP.NET Core and Angular Session
TypeScript
9
star
49

CodeMagazine-DotnetTools

Code Magazine Article Materials for Dotnet Tools Article
C#
8
star
50

VirtualFoxFest2021-FoxProRest

JavaScript
8
star
51

SaveToAzureBlob-MarkdownMonster-Addin

Markdown Monster Addin to open or paste images from your local machine and save them in Azure Blob Storage and embed link into your post.
C#
8
star
52

anti-trust-guilty-album

Anti-Trust Guilty Album - Punk Rock Music
JavaScript
7
star
53

Westwind.Webstore

West Wind Web Store Sample application
JavaScript
7
star
54

HelpBuilderReleases

West Wind Html Help Builder Releases and Bug Reporting
6
star
55

MarkdownMonsterReleases

6
star
56

Snippets-MarkdownMonster-Addin

A Snippet Expansion Manager for embedding templated text into Markdown Monster Markdown documents
C#
6
star
57

West-Wind-Message-Board

West Wind Message Board Web Connection (FoxPro) Sample Application
JavaScript
6
star
58

AspetCoreIISInprocessHostingSample

Simple test project optimized for Hello World style controller ops for comparison of hosting options on Windows
C#
5
star
59

DI2017-ASP.NET-Core-Localization

Session materials for DevIntersection 2017 - ASP.NET Core Localization
JavaScript
5
star
60

Padnug-2016-Angular-AspNet

Sample application and Slides from Rick's May 2nd, 2016 Angular ASP.NET Core Presentation
TypeScript
5
star
61

Console-MarkdownMonster-Addin

A simple Console/Terminal addin for Markdown Monster that displays a terminal window attached to the main Markdown Monster Window
C#
5
star
62

Westwind.Ai

Sample project that demonstrates OpenAI Image Generation
C#
5
star
63

datepicker-native

JavaScript and Vue helper components to make it easier to bind dates to the input/date control and a date button picker.
JavaScript
5
star
64

Westwind.AI

C#
4
star
65

Blazor_Playground

Blazor Sample Application
C#
4
star
66

WestwindWebSurgeReleases

Repository that holds releases for West Wind WebSurge
4
star
67

GithubRespositoryParser

C# Github Repository and Content Retrieval Examples using regular and GraphQL APIs.
C#
3
star
68

MarkdownMonsterAddinProjectTemplate

A Visual Studio Project Template for creating a Markdown Monster Addin
C#
3
star
69

Base64

C#
3
star
70

QfxToQboConverter

A small utility to fix up Quicken QIF files (.qfx) so they can be opened as QBO in Quickbooks.
C#
3
star
71

VirtualFoxFest2022-FoxProDotnet

Session Notes and Samples for Virtual FoxFest FoxPro .NET Interop Session
xBase
3
star
72

Live-Writer-SnagIt-Screen-Capture-Plugin

A Live Writer plug-in to provide screen capturing using TechSmith's SnagIt
C#
3
star
73

SWFOX2019_Vue

JavaScript
3
star
74

SWFOX18_WebConnectionSecurity

2
star
75

samples.west-wind.com

West Wind Samples Web Site
HTML
2
star
76

ChromiumPreview-MarkdownMonster-Addin

A Chromium Preview Browser Addin for the Markdown Monster Markdown Editor
C#
2
star
77

Westwind.Weblog

Source for Westwind Weblog
C#
2
star
78

KavaDocs-MarkdownMonster-Addin

KavaDocs Integration for Markdown Monster
C#
2
star
79

EmptyWebContentProjectTemplate

Empty Content Web Site Project that publishes from the root folder and works optionally with WebDeploy
HTML
2
star
80

SWFOX2019_DotnetCore

JavaScript
2
star
81

CODE.Framework.Core.ServiceHandler

C#
1
star
82

MarkdownMonsterDocumentation

JavaScript
1
star
83

swfox2024-wwdotnetbridge-revisited

Samples, Session Notes and Slides for Southwest Fox 2024 Sessions
HTML
1
star
84

dotnet-tools-padnug2020

1
star
85

WebSurgeDocumentation

Documentation for West Wind WebSurge
JavaScript
1
star
86

WebConnection-WebDemo

Web Connection Sample Application for the Getting Started Walk Through
JavaScript
1
star
87

HighPerformanceAspNet

C#
1
star
88

SWFOX2019_WebConnectionDeployment

PowerShell
1
star
89

SWFOX2018_MarkdownWithFoxPro

JavaScript
1
star