News for hackers. Stuff that matters.
Re:Show HN: Easily Customizable Toggle Buttons - jQuery Plugin by alexyoung on Monday August 20, 2012 @03:27PM (#4409336)
When handling options, I quite like this pattern:

    var settings = $.extend({
      dragable: true,
      clickable: true,
      ontext: 'ON',
      offtext: 'OFF',
      on: true,
      animtime: 300
    }, opts);
The $.extend method still returns a suitable object even if `opts` is undefined.

You also might want to `return this.each` so calls can be chained.

All of this is covered here: http://docs.jquery.com/Plugins/Authoring

Re:Show HN: Easily Customizable Toggle Buttons - jQuery Plugin by simontabor on Monday August 20, 2012 @06:11PM (#4410050)
Thank you Alex, I'll change it tomorrow!