Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building jQuery UI Plugins [closed]

Beyond the official documentation, are there any recommended resources for learning to build jQuery plugins. I'm particularly interested in building plugins for the UI libary.

I've been looking at the source for some of the official ones, but I've found they all look quite different from each other. Many are not well commented and it is difficult to tell what blocks of code are part of the essential structure and what is specific to a particular plugin.

If there aren't yet any good resources for this, can anyone clue me in on what basic structure I should be starting with when writing a plugin from scratch?

like image 872
Wilco Avatar asked Dec 09 '08 18:12

Wilco


1 Answers

Tutorial at "Learning jQuery"

Learning jQuery is a very helpful site, and has a great tutorial on plugin authoring.

One principle I really liked was: create default settings that users can override.

So maybe you can say $(this).highlight() and it will highlight blue by default. Or you can say $(this).highlight("green") and it will highlight green.

But you should also make it possible to say:

   $(this).highlight({
    foreground: 'red'
    });

...and it will highlight red from then on by default.

Other good resources

  • Fuel Your Coding article
  • Starter - tool for jumpstarting a plugin
like image 200
Nathan Long Avatar answered Sep 22 '22 13:09

Nathan Long