Code Monkey home page Code Monkey logo

jquery.splitter's Introduction

jQuery Splitter

npm bower

jQuery Splitter is plugin that split your content with movable splitter between them.

Example

var splitter = $('#foo').height(200).split({
    orientation: 'vertical',
    limit: 10,
    position: '50%', // if there is no percentage it interpret it as pixels
    onDrag: function(event) {
        console.log(splitter.position());
    }
});
<div id="foo">
    <div id="leftPane">Foo</div>
    <div id="rightPane">Bar</div>
</div>

Note: You need to set the height of the container for splitter to work.

You can use this css:

.container {
  height: 100vh !important;
}

to force full height.

Options

  • orientation - string 'horizontal' or 'vertical'.
  • limit - number or object {leftUpper: number, rightBottom: number} that indicate how many pixels where you can't move the splitter to the edge.
  • position - number or string with % indicate initial position of the splitter. (from version 0.28.0 you can use array of numbers or percents for multiple panels, array length need to have the same number as there are splitters so children.length - 1).
  • onDrag - event fired when draging the splitter, the event object is from mousemove
  • percent - boolean that indicate if spliter should use % instead of px (for use in print or when calling the window)

Methods

Instance returned by splitter is jQuery object with additional methods:

  • refresh()
  • option (name[, value]) - option setter/getter
  • position(number)|position([num1, num2, ...])|position() - position setter/getter (if you have 2 panels you can use single number to set the position for more panels you need to use array with panels - 1 same as number of splitters)
  • isActive - returns boolean
  • destroy() - remove splitter data

Demo

http://jquery.jcubic.pl/splitter.php

Patch Contributors

License

Copyright (C) 2010-2019 Jakub T. Jankiewicz <https://jcubic.pl/me>

Released under the terms of the GNU Lesser General Public License

jquery.splitter's People

Contributors

jcubic avatar plashenkov avatar beskorsova avatar inelsonrocha avatar roboncode avatar omphalos avatar cxong avatar fbergeron avatar lordjz avatar aeschylus avatar brulead avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.