From: S7012MY Date: Sat, 25 Jan 2014 18:28:51 +0000 (+0200) Subject: adds resizeble textbox X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=e9902b1b1f99d9298e3bdac4616ae3c457512b65;p=mindcoding-template-patches.git adds resizeble textbox --- diff --git a/css/style.css b/css/style.css index e69de29..a092440 100644 --- a/css/style.css +++ b/css/style.css @@ -0,0 +1,10 @@ +.txtstuff { + overflow: hidden; +} + +.hiddendiv { + display: none; + white-space: pre-wrap; + word-wrap: break-word; + overflow-wrap: break-word; /* future version of deprecated 'word-wrap' */ +} \ No newline at end of file diff --git a/js/scripts.js b/js/scripts.js index e69de29..fc421ab 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -0,0 +1,22 @@ +$( document ).ready(function() { + var txt = $('#comments'); + hiddenDiv = $(document.createElement('div')), + content = null; + + txt.addClass('txtstuff'); + hiddenDiv.addClass('hiddendiv common'); + + $('body').append(hiddenDiv); + + $(".form-control").on('keyup', function () { + + content = $(this).val(); + + content = content.replace(/\n/g, '
'); + hiddenDiv.html(content + '
'); + + $(this).css('height', hiddenDiv.height()+23); + + }); + +}); \ No newline at end of file