...

View Full Version : Collapsible text



rogerrkh
10-10-2008, 10:28 AM
Hi there

A while ago I was searching the web for suitable snippets of code for a web site that I was designing.

On one site I cannot remember the URL I found a snippet of code that allows a text box to collapse. At the time I thought what a stupid idea who would want that.

Now I can see a very good reason for putting it on the site and will eternally regret not downloading it at the time.

I was wondering if anyone out there what site this little snippet is on. I cannot remember if it was Javascript or css as at the time I was searching for both.

I you know where I can find this site then please send me a link to same.

Thank you

abduraooft
10-10-2008, 11:05 AM
This can be done in many ways like, automatic resize with content, drag and resize by mouse, one click expand/contract etc.

You'd get plenty of example from google by a search like http://www.google.com/search?q=javascript+expand+textarea

PS: Welcome to CF

rangana
10-10-2008, 11:19 AM
Could be of interest:


<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#trig').click(function()
{
if(this.value.toLowerCase()=='expand')
{
$('#mytxt').animate({height:'300px'},1000);
this.value='Collapse';
}
else
{
$('#mytxt').animate({height:'22px'},1000);
this.value='Expand';
}
});
});
</script>
<input type="text" id="mytxt"><br><input type="button" value="Expand" style="margin-top:10px;" id="trig">

rogerrkh
10-10-2008, 07:46 PM
Thanks I will try this when I get time.

My main Computer has just failed so I am currently using my lap top and whereas I have an internet connection all my files for the site are on my main computer so I will be busy downloading files to my laptop for a while.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum