<?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: Smart TextArea: scrollHeight in IE, Firefox, Opera and Safari</title>
	<atom:link href="http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/feed/" rel="self" type="application/rss+xml" />
	<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/</link>
	<description>Ideas, illustrations, tutorials and footprints of Kael</description>
	<lastBuildDate>Tue, 06 Jul 2010 14:07:18 +0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kael</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2995</link>
		<dc:creator>Kael</dc:creator>
		<pubDate>Tue, 06 Jul 2010 14:07:18 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2995</guid>
		<description>&lt;a href=&quot;#comment-2993&quot; rel=&quot;nofollow&quot;&gt;@拆墙部队:&lt;/a&gt; 一年多以前，还在学校的时候折腾的，见笑见笑。
转眼都快一年没更新了。</description>
		<content:encoded><![CDATA[<p><a href="#comment-2993" rel="nofollow">@拆墙部队:</a> 一年多以前，还在学校的时候折腾的，见笑见笑。<br />
转眼都快一年没更新了。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 拆墙部队</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2994</link>
		<dc:creator>拆墙部队</dc:creator>
		<pubDate>Sat, 03 Jul 2010 05:17:10 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2994</guid>
		<description>楼上那些人也用不着忽悠吧？好就是好，不好就是不好！</description>
		<content:encoded><![CDATA[<p>楼上那些人也用不着忽悠吧？好就是好，不好就是不好！</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 拆墙部队</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2993</link>
		<dc:creator>拆墙部队</dc:creator>
		<pubDate>Sat, 03 Jul 2010 05:16:19 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2993</guid>
		<description>无语，您是设计师？我纷纷表示怀疑！</description>
		<content:encoded><![CDATA[<p>无语，您是设计师？我纷纷表示怀疑！</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lemmi</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2988</link>
		<dc:creator>Lemmi</dc:creator>
		<pubDate>Sat, 29 May 2010 14:08:19 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2988</guid>
		<description>A very big thanks to your tips and ideas with browser interpretation of scrollHeight. I never thought, that it&#039;s so easy to autoresize a textarea - &lt;i&gt;after working on it a whole day!&lt;/i&gt; Thank you again!

Unfortunately - in my opinion - your code isn&#039;t formed very well. Therefore I coded my own version with your great idea based on the javascript framework Prototype.

&lt;strong&gt;Specials:&lt;/strong&gt;
- I added a special selector, which allows me to add the effect to all textareas with a given class, id or whatever. This is modifiable of course.
- I find a solution without adding a wrapper around the textarea. Maybe it&#039;s a bit flickerin in IE 6 ... but I&#039;m happy, that this works in IE 6 at all.

I tested this in Firefox 3, Safari 4, Opera 10, IE 7 and IE 8 on Win7 and Firefox 3, Safari 4, Opera 10, IE 6 on WinXP.

function resizeTextarea(textarea) {
    var minHeight = parseInt(textarea.getStyle(&#039;minHeight&#039;));
    textarea.style.height = minHeight + &#039;px&#039;;
    var newHeight = textarea.scrollHeight;
    if(Prototype.Browser.WebKit &#124;&#124; Prototype.Browser.IE) {
        var paddingTop = parseInt(textarea.getStyle(&#039;paddingTop&#039;));
        var paddingBottom = parseInt(textarea.getStyle(&#039;paddingBottom&#039;));
        newHeight = newHeight - (paddingTop + paddingBottom);
    }
    textarea.style.height = ((newHeight &gt; minHeight) ? newHeight : minHeight) + &#039;px&#039;
}

$$(&#039;textarea.autosize&#039;).collect(function(textarea) {
    textarea.style.overflow = &#039;hidden&#039;;
    resizeTextarea(textarea);
    textarea.observe(&#039;keyup&#039;, function() {
        resizeTextarea(textarea);
    });
});

I would be happy about any comments and feedback.</description>
		<content:encoded><![CDATA[<p>A very big thanks to your tips and ideas with browser interpretation of scrollHeight. I never thought, that it&#8217;s so easy to autoresize a textarea &#8211; <i>after working on it a whole day!</i> Thank you again!</p>
<p>Unfortunately &#8211; in my opinion &#8211; your code isn&#8217;t formed very well. Therefore I coded my own version with your great idea based on the javascript framework Prototype.</p>
<p><strong>Specials:</strong><br />
- I added a special selector, which allows me to add the effect to all textareas with a given class, id or whatever. This is modifiable of course.<br />
- I find a solution without adding a wrapper around the textarea. Maybe it&#8217;s a bit flickerin in IE 6 &#8230; but I&#8217;m happy, that this works in IE 6 at all.</p>
<p>I tested this in Firefox 3, Safari 4, Opera 10, IE 7 and IE 8 on Win7 and Firefox 3, Safari 4, Opera 10, IE 6 on WinXP.</p>
<p>function resizeTextarea(textarea) {<br />
    var minHeight = parseInt(textarea.getStyle(&#8217;minHeight&#8217;));<br />
    textarea.style.height = minHeight + &#8216;px&#8217;;<br />
    var newHeight = textarea.scrollHeight;<br />
    if(Prototype.Browser.WebKit || Prototype.Browser.IE) {<br />
        var paddingTop = parseInt(textarea.getStyle(&#8217;paddingTop&#8217;));<br />
        var paddingBottom = parseInt(textarea.getStyle(&#8217;paddingBottom&#8217;));<br />
        newHeight = newHeight &#8211; (paddingTop + paddingBottom);<br />
    }<br />
    textarea.style.height = ((newHeight &gt; minHeight) ? newHeight : minHeight) + &#8216;px&#8217;<br />
}</p>
<p>$$(&#8217;textarea.autosize&#8217;).collect(function(textarea) {<br />
    textarea.style.overflow = &#8216;hidden&#8217;;<br />
    resizeTextarea(textarea);<br />
    textarea.observe(&#8217;keyup&#8217;, function() {<br />
        resizeTextarea(textarea);<br />
    });<br />
});</p>
<p>I would be happy about any comments and feedback.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2987</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Mon, 24 May 2010 02:04:06 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2987</guid>
		<description>I think that you are silly will you show a div in the preview? i live blue. Oh no it does it all</description>
		<content:encoded><![CDATA[<p>I think that you are silly will you show a div in the preview? i live blue. Oh no it does it all</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 枫芸志 &#187; 【Javascrip】文本框textarea高度随内容自适应增长收缩</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2976</link>
		<dc:creator>枫芸志 &#187; 【Javascrip】文本框textarea高度随内容自适应增长收缩</dc:creator>
		<pubDate>Mon, 15 Mar 2010 14:23:01 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2976</guid>
		<description>[...] Smart TextArea: scrollHeight in IE, Firefox, Opera and Safari [...]</description>
		<content:encoded><![CDATA[<p>[...] Smart TextArea: scrollHeight in IE, Firefox, Opera and Safari [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derek</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2688</link>
		<dc:creator>derek</dc:creator>
		<pubDate>Sat, 12 Sep 2009 15:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2688</guid>
		<description>正打算开始学......</description>
		<content:encoded><![CDATA[<p>正打算开始学&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2684</link>
		<dc:creator>Chad</dc:creator>
		<pubDate>Thu, 06 Aug 2009 19:34:19 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2684</guid>
		<description>Thanks for this little break down.  Writing an auto-expanding textarea that worked in all browsers was becoming pretty confusing until I read your break down of the way height vs. scrollHeight is calculated between the different browsers.

Keep it up!</description>
		<content:encoded><![CDATA[<p>Thanks for this little break down.  Writing an auto-expanding textarea that worked in all browsers was becoming pretty confusing until I read your break down of the way height vs. scrollHeight is calculated between the different browsers.</p>
<p>Keep it up!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: liupeng</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2671</link>
		<dc:creator>liupeng</dc:creator>
		<pubDate>Wed, 08 Jul 2009 16:23:30 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2671</guid>
		<description>博客主题相当漂亮哦，全部采用英文写日志也是一个亮点，赞一下</description>
		<content:encoded><![CDATA[<p>博客主题相当漂亮哦，全部采用英文写日志也是一个亮点，赞一下</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HuangJ.in</title>
		<link>http://yottaworks.net/smart-textarea-scrollheight-ie-firefox-opera-safari/comment-page-1/#comment-2669</link>
		<dc:creator>HuangJ.in</dc:creator>
		<pubDate>Sat, 04 Jul 2009 16:07:56 +0000</pubDate>
		<guid isPermaLink="false">http://yottaworks.net/?p=1031#comment-2669</guid>
		<description>&lt;a href=&quot;#comment-2668&quot; rel=&quot;nofollow&quot;&gt;@Kael:&lt;/a&gt; 看得懂，写不出来，我悲哀的英语啊！哈哈，过几天自己也写一个这样的插件出来～</description>
		<content:encoded><![CDATA[<p><a href="#comment-2668" rel="nofollow">@Kael:</a> 看得懂，写不出来，我悲哀的英语啊！哈哈，过几天自己也写一个这样的插件出来～</p>
]]></content:encoded>
	</item>
</channel>
</rss>
