diff options
author | Aaron Parecki <aaron@parecki.com> | 2016-12-24 09:53:44 -0800 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2016-12-24 09:53:44 -0800 |
commit | b9a283f4b14f5b2f511171e96e3e4918bfa8a071 (patch) | |
tree | ccd0c9d1ce8379f77ffd0f628b37c63292f049e5 | |
parent | 29dcea294d4288d20842accad695852c62bdc3a1 (diff) |
automatically expand text field
closes #61
-rw-r--r-- | views/new-post.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/views/new-post.php b/views/new-post.php index bc77191..952f616 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -243,7 +243,15 @@ $(function(){ $("#note_content, #note_category, #note_in_reply_to, #note_slug, #note_photo_url").on('keyup change', function(e){ saveNoteState(); - }) + }); + + $("#note_content").on('keyup', function(){ + var scrollHeight = document.getElementById("note_content").scrollHeight; + var currentHeight = parseInt($("#note_content").css("height")); + if(Math.abs(scrollHeight - currentHeight) > 20) { + $("#note_content").css("height", (scrollHeight+30)+"px"); + } + }); $("#expand-reply").click(function(){ $('.reply-section').removeClass('hidden'); @@ -340,7 +348,6 @@ $(function(){ for(var i in data.mentions) { mentions += '@'+data.mentions[i]+' '; } - console.log(mentions); $("#note_content").val(mentions); } |