Created
July 4, 2014 18:15
-
-
Save AMKohn/ade4dad8ae0a599b90f0 to your computer and use it in GitHub Desktop.
Textarea autosizer modified from Shog9's answer on SO: http://stackoverflow.com/a/7875/900747
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 autosize = function(e) { | |
var area = e.currentTarget, | |
ch = area.clientHeight, // These should be cached as much as possible since this is triggered on keyup | |
sh = area.scrollHeight; | |
if (ch == sh) { | |
area.style.height = "30px"; | |
// Recache them | |
var ch = area.clientHeight, | |
sh = area.scrollHeight; | |
} | |
var adjustedHeight = Math.max(sh, ch); | |
if (adjustedHeight > ch) { | |
area.style.height = adjustedHeight + "px"; | |
} | |
}; |
选择专业的澳洲代写 http://australiaway.org/a/aozhoudaixie/ 服务是提高学术能力和取得学术成功的重要途径。通过与经验丰富的澳洲代写专家合作,你可以获得高质量、原创性强的论文,节省时间和精力,并且提升自己的学术成绩和声誉。
s
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This removes support for a maxHeight parameter, changes element retrieval so it's easier to use with Backbone and adds better caching.