Giter Club home page Giter Club logo

split-pane's Introduction

split-pane

jQuery Split Pane plugin

The plugin should work in IE8 and above as well as in Chrome, Safari and Firefox.

You can download split-pane.js and split-pane.css manually to you project or you can install with npm:

npm install split-pane

Split panes are initiated with

$(selector).splitPane();

Split pane component min-height and min-width are supported, and the component size can be set programmatically with

$(selector).splitPane('firstComponentSize', 0);"

or

$(selector).splitPane('lastComponentSize', 100);"

Only pixel values are supported.

Below is a basic example on how to use the plugin. Check out my blog post for some prettier examples.

You need to set up component widths and divider position using css, not as options to the JS splitPane function. The reason for this is that I like things to look good even before the JavaScript kicks in.

<!DOCTYPE html>
<html>
  <head>
		<title>Basic Example</title>
		<link rel="stylesheet" href="split-pane.css" />
		<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
		<script src="split-pane.js"></script>
		<style type="text/css">
			html, body {
				height: 100%;
				min-height: 100%;
				margin: 0;
				padding: 0;
			}
			.split-pane-divider {
				background: #aaa;
			}
			#left-component {
				width: 20em;
			}
			#my-divider {
				left: 20em; /* Same as left component width */
				width: 5px;
			}
			#right-component {
				left: 20em;  /* Same as left component width */
				margin-left: 5px;  /* Same as divider width */
			}
		</style>
		<script>
			$(function() {
				$('div.split-pane').splitPane();
			});
		</script>
	</head>
	<body>
		<div class="split-pane fixed-left">
			<div class="split-pane-component" id="left-component">
				This is the left component
			</div>
			<div class="split-pane-divider" id="my-divider"></div>
			<div class="split-pane-component" id="right-component">
				This is the right component
                <button onclick="$('div.split-pane').splitPane('firstComponentSize', 0);">Collapse first component</button>
			</div>
		</div>
	</body>
</html>

split-pane's People

Contributors

shagstrom avatar brrd avatar

Watchers

James Cloos 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.