<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ResizingTextArea Prototype Component</title>
	<atom:link href="http://ajaxian.com/archives/resizingtextarea-prototype-component/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/resizingtextarea-prototype-component</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Bermi</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-247396</link>
		<dc:creator>Bermi</dc:creator>
		<pubDate>Wed, 21 Feb 2007 09:40:56 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-247396</guid>
		<description>Seems like Wordpress ate my code, so I&#039;ve here is a direct link to the &lt;a href=&quot;http://www.bermi.org/code/resizable_textarea.js&quot; rel=&quot;nofollow&quot;&gt;Javascript Textarea Resizer&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Seems like WordPress ate my code, so I&#8217;ve here is a direct link to the <a href="http://www.bermi.org/code/resizable_textarea.js" rel="nofollow">Javascript Textarea Resizer</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bermi</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246413</link>
		<dc:creator>Bermi</dc:creator>
		<pubDate>Mon, 22 Jan 2007 23:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246413</guid>
		<description>I did this one some time ago inspired by a &lt;a href=&quot;http://openjsan.org/doc/g/gu/gugod/Widget/Textarea/Resizable/0.01/lib/Widget/Textarea/Resizable.html&quot; title=&quot;resizable text area widget&quot; rel=&quot;nofollow&quot;&gt;JSAN widget&lt;/a&gt;. 

It uses styles for calculating the height. And has been tested in IE 6/7,Safari and Firefox, although it might need some refactoring you might find it useful.

&lt;code&gt;
ResizeableTextarea = Class.create();
ResizeableTextarea.prototype = {
    initialize: function(element, options) {
        this.element = $(element);
        this.size = Element.getStyle(this.element, &#039;height&#039;).match(/^\d+/).first()*1;
        this.options = Object.extend({
            inScreen: false,
            resizeStep: 10,
            minHeight: this.size,
        }, options &#124;&#124; {});
        Event.observe(this.element, &quot;keyup&quot;, this.resize.bindAsEventListener(this));
        if ( !this.options.inScreen ) {
            this.element.style.overflow = &#039;hidden&#039;;
        }
        this.element.setAttribute(&quot;wrap&quot;,&quot;vitual&quot;);
    },
    resize : function(){
        this.shrink();
        this.grow();
    },
    shrink : function(){
        if ( this.size  this.element.clientHeight ) {
            if ( this.options.inScreen &amp;&amp; (20 + this.element.offsetTop + this.element.clientHeight) &gt; document.body.clientHeight ) {
                return;
            }
            this.size += 1;
            this.element.style.height = (this.options.resizeStep + this.size)+&#039;px&#039;;
            this.grow();
        }
    }
}
&lt;/code&gt;

Then just add 

&lt;code&gt;
onfocus=&quot;new ResizeableTextarea(this);&quot;
&lt;/code&gt;

to the textarea you want to resize.</description>
		<content:encoded><![CDATA[<p>I did this one some time ago inspired by a <a href="http://openjsan.org/doc/g/gu/gugod/Widget/Textarea/Resizable/0.01/lib/Widget/Textarea/Resizable.html" title="resizable text area widget" rel="nofollow">JSAN widget</a>. </p>
<p>It uses styles for calculating the height. And has been tested in IE 6/7,Safari and Firefox, although it might need some refactoring you might find it useful.</p>
<p><code><br />
ResizeableTextarea = Class.create();<br />
ResizeableTextarea.prototype = {<br />
    initialize: function(element, options) {<br />
        this.element = $(element);<br />
        this.size = Element.getStyle(this.element, 'height').match(/^\d+/).first()*1;<br />
        this.options = Object.extend({<br />
            inScreen: false,<br />
            resizeStep: 10,<br />
            minHeight: this.size,<br />
        }, options || {});<br />
        Event.observe(this.element, "keyup", this.resize.bindAsEventListener(this));<br />
        if ( !this.options.inScreen ) {<br />
            this.element.style.overflow = 'hidden';<br />
        }<br />
        this.element.setAttribute("wrap","vitual");<br />
    },<br />
    resize : function(){<br />
        this.shrink();<br />
        this.grow();<br />
    },<br />
    shrink : function(){<br />
        if ( this.size  this.element.clientHeight ) {<br />
            if ( this.options.inScreen &amp;&amp; (20 + this.element.offsetTop + this.element.clientHeight) &gt; document.body.clientHeight ) {<br />
                return;<br />
            }<br />
            this.size += 1;<br />
            this.element.style.height = (this.options.resizeStep + this.size)+'px';<br />
            this.grow();<br />
        }<br />
    }<br />
}<br />
</code></p>
<p>Then just add </p>
<p><code><br />
onfocus="new ResizeableTextarea(this);"<br />
</code></p>
<p>to the textarea you want to resize.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leland Scott</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246227</link>
		<dc:creator>Leland Scott</dc:creator>
		<pubDate>Thu, 18 Jan 2007 02:18:38 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246227</guid>
		<description>FYI, if you&#039;re using the nightly WebKit build or Safari 3.0, you don&#039;t need any javascript magic to get resizable textareas. They&#039;re standard fare... every textarea you encounter on the web can be resized as needed. WebKit may have turned the preference for this off by default, but if you enter the following command in the terminal, I think this is the command I issued some time ago to turn resizable textareas on:

defaults write com.apple.safari WebKitTextAreasAreResizable boolean true

Cheers,
Leland</description>
		<content:encoded><![CDATA[<p>FYI, if you&#8217;re using the nightly WebKit build or Safari 3.0, you don&#8217;t need any javascript magic to get resizable textareas. They&#8217;re standard fare&#8230; every textarea you encounter on the web can be resized as needed. WebKit may have turned the preference for this off by default, but if you enter the following command in the terminal, I think this is the command I issued some time ago to turn resizable textareas on:</p>
<p>defaults write com.apple.safari WebKitTextAreasAreResizable boolean true</p>
<p>Cheers,<br />
Leland</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morgan Roderick</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246193</link>
		<dc:creator>Morgan Roderick</dc:creator>
		<pubDate>Wed, 17 Jan 2007 12:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246193</guid>
		<description>Does not exactly work as intended with non-strict rendering in Gecko / WebKit browsers. Perhaps a little more testing is needed.</description>
		<content:encoded><![CDATA[<p>Does not exactly work as intended with non-strict rendering in Gecko / WebKit browsers. Perhaps a little more testing is needed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Moser</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246174</link>
		<dc:creator>Jason Moser</dc:creator>
		<pubDate>Tue, 16 Jan 2007 22:51:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246174</guid>
		<description>This is a pretty simple and easy way to make text areas grow when need be.  Came in pretty handy for my app and i made a quick demo since a few people asked for it.

http://jasonmoser.com/ajax</description>
		<content:encoded><![CDATA[<p>This is a pretty simple and easy way to make text areas grow when need be.  Came in pretty handy for my app and i made a quick demo since a few people asked for it.</p>
<p><a href="http://jasonmoser.com/ajax" rel="nofollow">http://jasonmoser.com/ajax</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: boodie</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246164</link>
		<dc:creator>boodie</dc:creator>
		<pubDate>Tue, 16 Jan 2007 20:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246164</guid>
		<description>Does this really have anything to do with ajax? it&#039;s javascript counting characters...</description>
		<content:encoded><![CDATA[<p>Does this really have anything to do with ajax? it&#8217;s javascript counting characters&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Burnett</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246163</link>
		<dc:creator>Chris Burnett</dc:creator>
		<pubDate>Tue, 16 Jan 2007 20:31:18 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246163</guid>
		<description>oh well.</description>
		<content:encoded><![CDATA[<p>oh well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Burnett</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246162</link>
		<dc:creator>Chris Burnett</dc:creator>
		<pubDate>Tue, 16 Jan 2007 20:30:09 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246162</guid>
		<description>try this again.
&lt;code&gt;
$.fn.ResizeArea = function() {
	var defaultRows = 1; 
	var resizeNeeded = function () {
        var lines = $(this).val().split(&#039;\n&#039;);
        var newRows = lines.length + 1;
        var oldRows = $(this).attr(&#039;rows&#039;);
        for (var i = 0; i = $(this).attr(&#039;cols&#039;)) 
				newRows += Math.floor(line.length / $(this).attr(&#039;cols&#039;));
        }
        if (newRows &gt; $(this).attr(&#039;rows&#039;)) 
			$(this).attr(&#039;rows&#039;,newRows);
        if (newRows &lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>try this again.<br />
<code><br />
$.fn.ResizeArea = function() {<br />
	var defaultRows = 1;<br />
	var resizeNeeded = function () {<br />
        var lines = $(this).val().split('\n');<br />
        var newRows = lines.length + 1;<br />
        var oldRows = $(this).attr('rows');<br />
        for (var i = 0; i = $(this).attr('cols'))<br />
				newRows += Math.floor(line.length / $(this).attr('cols'));<br />
        }<br />
        if (newRows &gt; $(this).attr('rows'))<br />
			$(this).attr('rows',newRows);<br />
        if (newRows </code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Burnett</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246161</link>
		<dc:creator>Chris Burnett</dc:creator>
		<pubDate>Tue, 16 Jan 2007 20:28:30 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246161</guid>
		<description>Re-written for jquery:
&lt;code&gt;
$.fn.ResizeArea = function() {
	var defaultRows = 1; 
	var resizeNeeded = function () {
        var lines = $(this).val().split(&#039;\n&#039;);
        var newRows = lines.length + 1;
        var oldRows = $(this).attr(&#039;rows&#039;);
        for (var i = 0; i = $(this).attr(&#039;cols&#039;)) 
				newRows += Math.floor(line.length / $(this).attr(&#039;cols&#039;));
        }
        if (newRows &gt; $(this).attr(&#039;rows&#039;)) 
			$(this).attr(&#039;rows&#039;,newRows);
        if (newRows &lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Re-written for jquery:<br />
<code><br />
$.fn.ResizeArea = function() {<br />
	var defaultRows = 1;<br />
	var resizeNeeded = function () {<br />
        var lines = $(this).val().split('\n');<br />
        var newRows = lines.length + 1;<br />
        var oldRows = $(this).attr('rows');<br />
        for (var i = 0; i = $(this).attr('cols'))<br />
				newRows += Math.floor(line.length / $(this).attr('cols'));<br />
        }<br />
        if (newRows &gt; $(this).attr('rows'))<br />
			$(this).attr('rows',newRows);<br />
        if (newRows </code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tobi</title>
		<link>http://ajaxian.com/archives/resizingtextarea-prototype-component/comment-page-1#comment-246155</link>
		<dc:creator>tobi</dc:creator>
		<pubDate>Tue, 16 Jan 2007 17:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2015#comment-246155</guid>
		<description>The problem is that this does a lot of math based on the Col parameter of the text area which is not accurate when the text area is resized with CSS.</description>
		<content:encoded><![CDATA[<p>The problem is that this does a lot of math based on the Col parameter of the text area which is not accurate when the text area is resized with CSS.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

