Two Quick jQuery plugins before bedtime
Just a couple of extractions from recent projects that may be useful to somebodies.
First up is an automatically growing textarea. This implementation is borrowed from Facebook and uses an off-screen auxiliary <div> to calculate the required dimensions of the textarea. Usage is simple:
- $('textarea').autogrow();
Next is a cookie-based style switcher, the obvious use of which is toggling between small/medium/large text. Quite why the browser supplied zoom features are insufficient is a mystery to me, but hey ho, the client is always right.
- cookieResize('#sizer a', 'medium');
The first argument is a selector matching the resize/style-switching links. When the user clicks any of these its CSS class will be applied to document.body - this class name will also be stored in a cookie for retrieval on successive page views. The second argument is the default class to use if no cookie is present.
No official plugin pages for these; just copy and paste into your project…
Linkage: auto-growing textarea | cookie-based style switcher

