views:

228

answers:

1

I have a text area in which users can type source code (html/css/js). I want to be able to let them click a "switch to fullscreen" link to make the editor fullscreen.

Of course, this should work on any resolution and must also resize when a users resizes it's window.

I found this plugin, http://plugins.jquery.com/project/fulltextarea, but it's not resizing when the browser windows is resized.

Any tips or plugins for this one?

+3  A: 

You could handle the event if you wanted:

$(window).resize(function() {
   var $textarea = $('#yourTextArea');
   var $window = $(this);
   $textarea.height( $window.height() );
   $textarea.width( $window.width() );
});
Dan Heberden
`var $textarea = $(this);` <- note that `this` in the context of the window resize event is the window itself. The event isn't attached to the textarea. It's an easy fix though, just use a selector for your textarea.
Andy E
Yeah, i had $('#yourTextArea').resize to start and realized my mistake but didn't think to fix the other stuff - thanks for pointing it out :)
Dan Heberden