I think I would still be able to chain after the initial plugin call, but not on subsequent method calls... but I see what you are saying.
Interesting. So in your first example there I would be checking if the argument was an object... and call init() if it was, otherwise examine the string and call either advance or back. I'll give that a shot. Thanks for the input! Best, Robert On Jun 22, 3:39 am, Damir Zekić <dam...@gmail.com> wrote: > On Jun 22, 7:10 am, Bob Spryn <bobsp...@gmail.com> wrote: > > > Ok I actually figured it out, but I'm not sure if this is even a ok > > way to be doing this. > > > Basically this just initializes the plugin and gives my variable the > > advance, back, and reset methods with the appropriate settings. > > > var screenwizard = $("#someframe").screenWizard(opts) > > > Now I can do screenWizard.advance(). > > > Is there a much better way to build something like this? > > With this approach you are removing the ability to chain functions > after your plugin, which breaks the jQuery's convention and the > principle of least surprise. The better interface for manipulating > steps of the wizard would be to implement more standard approach with > string parameters: > > // the screnwizard here is just jQuery object for #someframe > var screenwizard = $("#someframe").screenWizard(opts); > screenwizard.screenWizard('advance'); > screenwizard.screenWizard('back'); > > You can examine type of the argument in your plugin function and then > call respectively init(), advance() or back() functions. > > Another standardized approach would be: > > var screenwizard = $("#someframe").screenWizard(opts); > $.screenWizard.back(screenwizard); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---