Created
August 27, 2012 11:01
-
-
Save cburgmer/3487472 to your computer and use it in GitHub Desktop.
The smallest "resizable" implementation there is
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.resizable { | |
resize: both; /* Options: horizontal, vertical, both */ | |
overflow: auto; /* Options: scroll, hidden, auto */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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