Joyce Babu
Joyce Babu

Reputation: 20714

Need examples of some well written jQuery plugins

I have seen people writing jQuery plugins in different styles. Some authors use a private methods object (within a closure) and invoke the method using methods[fn].call(this, args) style. There are other who create a new object of a private class, and invoke the method like this.fn(). Few other use ui.widget as the base for their plugin.

Which of these methods would you suggest for a plugin? I am not interested in using ui.widget, because it is an extra dependency, which can be avoided. Can anyone suggest some well written jQuery plugins, which will help me write better plugins.

Upvotes: 1

Views: 454

Answers (1)

King Friday
King Friday

Reputation: 26106

I don't know if mine are well written or not. I kept it very simple at first then gradually added functionality to allow for instance manipulation etc. The ones I wrote are terse if that's what you mean by well written and they do get a lot of downloads.

Just search on dumbFormState and dumbCrossFade or "how to create plugins that are instance aware" and you will find my writings and code.

The first thing you must do to have the possibility of being great is knowing your sh**.

1) Watch Douglas Crockford videos over and over until it sticks. He is brilliant. I cannot stress this first one enough. 2) Study popular jQuery plugin implementations since after looking at Crockford, you will get it. 3) Go through John Resig's Advanced JavaScript Tutorial. He is brilliant. I cannot stress this enough.

The road to learning this is not easy however, if you go deep and you will reap.

Upvotes: 1

Related Questions