I found this to be the best example of how to structure a plug-in:

http://www.learningjquery.com/2007/10/a-plugin-development-pattern

Rik


2008/11/21 Hector Virgen <[EMAIL PROTECTED]>:
> You should take a look at jQuery's built-in tabs plugin. It may already do
> what you're looking for.
> http://docs.jquery.com/UI/Tabs
> -Hector
>
>
> On Fri, Nov 21, 2008 at 1:44 PM, halcyonandon <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I'm new to JQuery, but I need to convert some regular, working,
>> javascript code into a JQuery plugin.  I'll need to expand on this
>> code once its in plugin form, but for now its just converting this
>> existing code into a working JQuery plugin.  I've reviewed the
>> documentation on plugin authoring, but it doesnt give a lot of
>> examples.
>>
>> I was hoping someone could show me how a snippet of my code would look
>> as a JQuery plugin to put me on the right track.
>>
>> function initTabs() {
>>    if (document.getElementById && document.createTextNode) {
>>        var n = document.getElementById('tbs');
>>        var as = n.getElementsByTagName("a");
>>        for (var i = 0; i < as.length; i++) {
>>            as[i].onclick = function() {
>>                showTab(this);
>>                return false;
>>            };
>>            as[i].onfocus = function() {
>>                this.blur();
>>            };
>>            if (i == 0)
>>                currentLink = as[i];
>>        }
>>        if (document.getElementById(currentTab)) {
>>            document.getElementById(currentTab).style.display =
>> 'block';
>>        }
>>    }
>> }
>>
>> Thank you for your time.
>
>



-- 
Rik Lomas
http://rikrikrik.com

Reply via email to