Skip to content

Instantly share code, notes, and snippets.

@cburgmer
Created August 27, 2012 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cburgmer/3487472 to your computer and use it in GitHub Desktop.
Save cburgmer/3487472 to your computer and use it in GitHub Desktop.
The smallest "resizable" implementation there is
.resizable {
resize: both; /* Options: horizontal, vertical, both */
overflow: auto; /* Options: scroll, hidden, auto */
}
var registerResizeHandler = function (element, handler) {
var width = element.style.width,
height = element.style.height;
element.onmouseup = function () {
if (width !== element.style.width || height !== element.style.height) {
width = element.style.width;
height = element.style.height;
handler(width, height);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment