A JavaScript library allowing the creation of manually resizable div elements.

Overview

Resizable.js

A JavaScript library allowing the creation of resizable html divs. Try the live demo!

Resizable Example Gif

Setup

Link to both resizable.js and resizable-style.css within the webpage and call: Resizable.initialise(parentId, sizes, resizerThickness) Where "parentId" is the element ID of the parent <div> containing your resizable windows and "sizes" is an object literal containing the size values for how much space a child window will initally occupy within its parent (i.e. how far along the resizer line will appear). An empty object {}will cause it to default to equal sizes. The third argument "resizerThickness" allows you to specify how thick the dividing lines will be. This is optional and will default to 4px.

Example:

sizes = {
	"leftChildId": 0.75
}

The above sizing will cause the left child to start at 75% of its parent's width with the right window filling the remaining 25%.

The layout of the resizable windows will be determined by the structure of your HTML and the CSS classes given to the nested <div> elements.

The recognised CSS classes are:

"resizable-top"
"resizable-bottom"
"resizable-left"
"resizable-right"

A parent <div> must be created with a unique ID. To split this parent with a horizontal resizer line, it must contain exactly two child <div> elements with classes of "resizable-top" and "resizable-bottom" respectively. To split the parent with a vertical line, it must contain exactly two child <div> elements with classes of "resizable-left" and "resizable-right" respectively. Any of these child <div> elements can be further split by including two more children within them. Further nesting of <div> elements allows for complex resizable layouts to be created.

To hopefully better demonstrate the correct way to create a layout, the HTML code for the demo page is included below:

<div  id="main">
  <div  class="resizable-left"  id="win1">
    <div  class="resizable-top"  id="win3">
      <div  class="resizable-left"  id="win5">
      </div>
      <div  class="resizable-right"  id="win6">
      </div>
    </div>
    <div  class="resizable-bottom"  id="win4">
    </div>
  </div>
  <div  class="resizable-right"  id="win2">
    <div  class="resizable-top"  id="win7">
      <div  class="resizable-left"  id="win9">
      </div>
      <div  class="resizable-right"  id="win10">
        <div  class="resizable-top"  id="win11">
          <div  class="resizable-left"  id="win13">
          </div>
          <div  class="resizable-right"  id="win14">
          </div>
        </div>
        <div  class="resizable-bottom"  id="win12">
        </div>
      </div>
    </div>
    <div  class="resizable-bottom"  id="win8">
    </div>
  </div>
</div>

It is important to never mix top/bottom and left/right CSS classes within direct children of an element.

The diagram below shows the div ID's of the windows in the demo. They are numbered in the order they're created by the instantiation function. These IDs are for illustrative purposes only, you do not need to give individual IDs to the <div> elements in your page, Window ID Diagram

Comments
  • addEventListeners no longer working

    addEventListeners no longer working

    When I added the splitters, it stopped handling events on other elements such as 'click' It still receives click event add document and window level, but not on individual element level of splitter div child elements

    opened by stephkyle 2
  • Dynamic Containers

    Dynamic Containers

    Hello,

    I tried to use this library inside a dynamic container that shares the page with a sidebar. When the sidebar is collapsed, the dimensions of this container change accordingly. Unfortunately, I couldn't get this to work as the dimensions of the parent container are dynamic. Is there a way to fix this?

    Thank you for your response in advance!

    opened by Looky1173 2
  • When I modify the size of the windows the content is selected.

    When I modify the size of the windows the content is selected.

    This happens to me in Firefox.

    I'm not sure if I'm doing something wrong, or maybe there is some incompatibility with the web browser. I am using the example configuration.

    The problem is that when you drag the resizer the content of the windows is selected and, when I drop it, it is sometimes selected and sometimes not.

    Thank you very much for the contribution. It has been very useful!

    opened by ghost 1
  • Could you please add a license?

    Could you please add a license?

    I was interested in using your code. But, according to https://choosealicense.com/no-permission/ - as your repo has no license (that I could find), "that generally means [others] have no permission from the creators of the software to use, modify, or share the software"

    So if you could add a license, that'd be great. Thanks!

    opened by MichaelChambers 1
  • Min and max size

    Min and max size

    Really cool project! But there are a few things I would add. One of them is an option to add minimum and maximum size to some windows. For example, I could have a 0.2 window (20%) but force it to be between 100 and 200 pixels. I've taken a look into your code, and I think it wouldn't be that hard to implement that feature.

    opened by Arnau478 1
  • CSS universal selector is too aggressive

    CSS universal selector is too aggressive

    Hi. Thank you for the great work!

    This CSS rule seems to be too aggressive and affects other parts of the page:

    * {
      padding: 0;
      margin: 0;
      top: 0;
      left: 0;
    }
    

    In my case it broke the positioning of the element with position: absolute and right: 0.

    opened by red-meadow 1
  • Keeping middle pane independent?

    Keeping middle pane independent?

    Hi,

    I've got a couple of questions rather than issues. Hope you don't mind but just couldn't find a place where to ask these:

    1. Resize

    Is there a way to have 3 panes and allow to resize the left pane and the right pane independently without resizing the middle or left/right pane depending on which one is being resized.

    This is what I have:

    <div id="main">
        <div class="resizable-left" id="win1">
        </div>
        <div class="resizable-right" id="win2">
            <div class="resizable-left" id="win4"></div>
            <div class="resizable-right" id="win5"></div>
        </div>
    </div>
    

    but the above resize the right pane and middle pane when I resize the left pane for example. When resizing the right pane, it is behaving as I'd like it. It resizes the right and content pane without changing the left pane. I can see why based on the above definition but ideally, I'd like to be something like this:

    <div id="main">
        <div class="resizable-left" id="win1">
        </div>
        <div class="resizable-center-fix" id="win3">
        </div>
        <div class="resizable-right" id="win2">
        </div>
    </div>
    

    Where the "resizable-center-fix" only gets resized when either the left or right pane get resized. Hope this makes sense?

    1. Are there events available? The reason I'm asking is that every time, a pane is resized, I'd like to save its size immediately to local storage so that I can restore it when my page is reloaded the next time the user opens my web app?

    2. Hiding pane? Can a pane be hidden at run-time and if it is, will the other pane be adjusted accordingly? For example, imagine if I have a vertical split embedded in the left pane and I want to hide the bottom pane. Will the top pane stretch all the way to the bottom?

    Thanks.

    Thierry

    opened by tfierens 1
  • 3 questions

    3 questions

    Really cool library. I've been looking for someting like it a while now. I've got a few questions.

    1. Is it possible to make the handle bars larger than 4px without break anything?
    2. In the demo you split with 2 divs at most. Would it work to have 3 resizeable divs in a row?
    3. If possible to have 3 resizable divs in a row, would it be possible to have one of them at a fixed (locked) size? Only two of them can move.
    opened by jenstornell 1
  • Resizer width are not considered to calculate sizes of every contentWindow

    Resizer width are not considered to calculate sizes of every contentWindow

    Imagine we have a "main" div with 100px width, and we configure 2 content windows with 0.5 size. When we inspect the size of activeContentWindows, the sizeFractionOfParent is not 0.5 for both windows, it's 0.5 for one and 0.49xxx for the other.

    This causes that, when I save these sizes and then I reload them to initialize the layout, the sizes rendered are different from first load. And if I save the sizes and I reload them several times (always without move the resizers) it will be worse. This sample is with only one resizer. If you configure a lot of contentWindows with several resizers, the effect will be more clear.

    Any workaround to calculate the real size of every content window ?

    Thanks.

    opened by daniherculano84 1
Owner
null
A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic animation.

Lava-Lamp Description: A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic anima

Richard Hung 38 Jun 4, 2022
Create a deep copy of a set of matched elements with the dynamic state of all form elements copied to the cloned elements.

jq-deepest-copy FUNCTION: Create a deep copy of a set of matched elements while preserving the dynamic state of any matched form elements. Example Use

Michael Coughlin 5 Oct 28, 2022
Drag and drop library for two-dimensional, resizable and responsive lists

DEPRECATED This project is no longer maintained, please consider using react-grid-layout instead. GridList Drag and drop library for a two-dimensional

Hootsuite 3.6k Dec 14, 2022
Manually curated collection of resources for frontend web developers.

Frontend Development Manually curated collection of resources for frontend web developers. You are viewing a browseable version, split by category in

Tim Navrotskyy 36.4k Jan 1, 2023
Toggle Dark-Mode manually on InStream.de

InStream.de Dark-Mode Umschalter Was es macht Dieses Add-On für Firefox fügt einen Button hinzu, mit dem man websites zwischen "Normal" und "Dark-Mode

InStream.de 2 Feb 7, 2022
Manually curated collection of resources, plugins, utilities, and other assortments for the Sapphire Community projects.

Awesome Sapphire Manually curated collection of resources, plugins, utilities, and other assortments for the Sapphire Community projects. Has your pro

Sapphire 20 Dec 17, 2022
Download all Moodle files with one click. This is a Chrome extension built to save time and effort from downloading files manually one by one!

Moodle Downloader Extension Moodle downloader extension for Chrome. The extension is tested with both the TUM moodle and the official moodle demo. Not

Zhongpin Wang 8 Nov 15, 2022
Zemi is data-driven and reverse-routing library for Express. It provides out-of-the-box OpenAPI support, allowing you to specify and autogenerate an OpenAPI spec.

zemi zemi is a data-driven routing library for Express, built with Typescript. Features: optional, out-of-the-box support for OpenAPI reverse-routing

Yoaquim Cintrón 5 Jul 23, 2022
4Web is a collection&creation of codebase, frameworks, libraries dedicated to web development 📦

?? You can also contribute to add / create your own collection in this repository Collection name Description ?? blinke

Raja Rakotonirina 5 Nov 14, 2022
FormGear is a framework engine for dynamic form creation and complex form processing and validation for data collection.

FormGear is a framework engine for dynamic form creation and complex form processing and validation for data collection. It is designed to work across

Ignatius Aditya Setyadi 91 Dec 27, 2022
Best dialogue for file creation, renaming, opening, deletion or jumping to a specific line

Features No need to rely on vscode.quickOpen Create, rename, delete, open files/folders without relying on the sidebar Jump to specific lines Find spe

Suryansh Makharia 3 Jul 31, 2022
Allow moving/copying/and creation embeds for blocks with drag-n-drop just like Logseq or Roam

Demo Features Drag-n-drop for list items in the same pane and between different panes 3 modes: move block, copy block, embed block Automatic reference

null 92 Dec 26, 2022
A Cli that handles the creation of a basic express App that supports Husky configuration & static analysis tools

@phazero/create-express-app · Create express app is a CLI that can generate boiler plate code for setting up an express app. Installation & Usage npx

PhazeRo 13 Oct 29, 2022
4WEB is a collection & creation of codebase, frameworks, libraries and various resources dedicated to web development 📦🌐

?? Vous pouvez également contribuer à ajouter/créer votre propre collection dans ce référentiel ... Table des matières ?? Codebase ?? NPM packages ??

Raja Rakotonirina 5 Nov 14, 2022
Theme Redone is a custom WordPress theme starter/framework with its own Gutenberg blocks solution and a CLI that speeds up the block creation process.

Theme Redone The Framework for Developing Custom WordPress Themes with its own Gutenberg Blocks creation solution. Theme Redone is a custom WordPress

null 103 Dec 30, 2022
Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate and produce the video.

?? Introduction Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate

Incredible 113 Dec 6, 2022
dynamic-component-app is an angular application for dynamic component template creation

MyApp This project was generated with Angular CLI version 14.1.0. Development server Run ng serve for a dev server. Navigate to http://localhost:4200/

Aniket Muruskar 7 Aug 26, 2022
A markdown based tool for slide deck creation.

Decker A markdown based tool for slide deck creation. Installation from source Install stack and Node.js (for npm) Clone this repo. cd decker git subm

Decker 8 Nov 7, 2022
A Node.js REST API example built with Express and Typescript that can be used as template for creation of new servers.

api-example-firebase-nodejs A Node.js REST API example built with Express and Typescript that can be used as template for creation of new servers. The

Rodrigo João Bertotti 5 Nov 25, 2022