• Prev
  • Stop
  • Play
  • Next
  • Aquarium
  • Fine Day
  • Bright Green Lights
  • For Your Smile
  • Pull You Through
  • In Your System
  • ♻ retweet this page
  • contact me
  • subscribe
  • follow me on twitter
    • 2010-03-06T23:08 is it true O2 are launching a daily tethering option for the iPhone?
    • 2010-03-06T22:52 result of today's hacking: http://bit.ly/bYEq0w
    • 2010-03-05T22:40 these days my brain just filters out all of these three-point product intros. "tag. share. discover." meh.
    • 2010-03-05T22:24 def collatz(x); puts x; return if x == 1; if x % 2 == 1; collatz((3 * x) + 1) else collatz(x / 2); end end #xkcd
    • 2010-03-03T23:21 @nathanstaines no probs. someone else emailed me with the same issue and then the penny dropped :) qcd site looks awesome btw.
  • elsewhere
    • github github
    • linkedin linkedin
    • delicious delicious
    • flickr flickr
    • email email

  • Home
  • Logfile
  • Open Sawrce
  • Labs
  • About
  • Sitemap
14.09.2008

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:

Autogrowing textarea example:
  1. $('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.

Cookie-based style switcher example:
  1. 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

Archives

  • December 2009 (2)
  • May 2009 (1)
  • March 2009 (1)
  • January 2009 (1)
  • October 2008 (1)
  • September 2008 (2)
  • August 2008 (2)
  • June 2008 (2)

Friends

  • Magic Lamp
  • Garage Duo
  • Atom
  • Drew not Weird
  • Enthusiastik
  • Fusible Front
  • Jam Hot
  • John Disco
onehackoranother.com © 2008 - 2010 Jason Frame. All rights reserved.