scrollbalance
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "scrollbalance", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Uses position: fixed to combat unsightly gaps in multi-column layouts, when columns are of different heights.", | ||
@@ -5,0 +5,0 @@ "main": "scrollbalance.js", |
@@ -1,6 +0,6 @@ | ||
# jQuery Scroll Balance | ||
# ScrollBalance.js | ||
A jQuery plugin that intelligently uses position: fixed to combat unsightly gaps | ||
in multi-column layouts, when columns are of different heights. See index.html | ||
for a demo. | ||
A javascript plugin that intelligently uses position: fixed to combat unsightly gaps | ||
in multi-column layouts, when columns are of different heights. See | ||
<http://gregplaysguitar.github.io/ScrollBalance.js/> for a demo. | ||
@@ -15,3 +15,3 @@ Requires jquery version 1.7 or higher. | ||
or manually: | ||
or via cdn: | ||
@@ -28,4 +28,5 @@ <script type="text/javascript" src="https://www.gitcdn.xyz/repo/gregplaysguitar/ScrollBalance.js/master/ScrollBalance.js"></script> | ||
Columns must be side-by-side, which usually means floated, but doesn't have to - | ||
they could be absolutely positioned. | ||
Columns could be floated, inline-block or positioned absolutely - the only | ||
requirement is that they're side-by-side on the page. | ||
Initialise the plugin like so: | ||
@@ -46,17 +47,27 @@ | ||
- minwidth: disable the plugin if the screen width is less than this | ||
(default 0) | ||
- threshold: threshold for activating the plugin, eg the column heights must | ||
differ by at least this amount to be affected. (default 100) | ||
- `minwidth` | ||
disable the plugin if the screen width is less than this (default 0) | ||
- `threshold` | ||
threshold for activating the plugin, eg the column heights must differ by at | ||
least this amount to be affected. (default 100) | ||
Advanced example: | ||
### Methods | ||
var scrollbalance = new ScrollBalance($('.column'), { | ||
// disable on mobile screens | ||
minwidth: 767, | ||
- `initialize: function ()` | ||
Recalculate column heights and positioning, for example if content changes | ||
- `resize: function (winWidth, winHeight)` | ||
Handle a browser resize event | ||
- `scroll: function (scrollTop, scrollLeft)` | ||
Handle a browser scroll event | ||
- `bind: function ()` | ||
Bind resize and scroll to the window's corresponding events | ||
- `unbind: function ()` | ||
Remove resize and scroll from the window's corresponding events | ||
- `disable: function ()` | ||
Disable scrollbalance | ||
- `enable: function ()` | ||
Enable scrollbalance | ||
- `teardown: function ()` | ||
Remove all traces of scrollbalance from the content | ||
// disable if columns differ by less than 200px | ||
threshold: 200 | ||
}); | ||
### Scroll / resize event handling | ||
@@ -91,4 +102,7 @@ | ||
this, wrap the column content in a div with the class scrollbalance-inner and | ||
this will be used instead. The div should have no styling. | ||
this will be used instead. The div should have no styling. E.g. | ||
<div class="column"><div class="scrollbalance-inner">...</div></div> | ||
<div class="column"><div class="scrollbalance-inner">...</div></div> | ||
### Dynamic content | ||
@@ -136,3 +150,3 @@ | ||
See index.html for a demo. | ||
See <http://gregplaysguitar.github.io/ScrollBalance.js/> for a demo. | ||
@@ -139,0 +153,0 @@ ## License |
@@ -136,5 +136,4 @@ /*! | ||
} | ||
that.balance(col, columnData, true); | ||
}); | ||
this.balance_all(true); | ||
}, | ||
@@ -141,0 +140,0 @@ resize: function (winWidth, winHeight) { |
Sorry, the diff of this file is not supported yet
153
29278