So here's what I've done and it seems to be working pretty well. Let me know if I'm doing anything weird. (I'm going to provide access to the default options object publicly at some point, but its working for now)
//Simple screen wizard plugin ;(function($) { $.fn.screenWizard = function (options) { var defaultOptions = { size : "100", duration : 1000, defaultLeft : 0 }; if (typeof options === "object") { return init(this, options); } else if (typeof options === "string"){ switch (options) { case "advance": return advance(this); break; case "back": return back(this); break; case "reset": default: return reset(this); break; } } function init(obj, options){ obj.settings = $.extend(defaultOptions, options); return obj.each(function(){}); }; function advance(obj){ return obj.each(function(){ var current = parseInt($(obj).css("left")); $(this).animate({left: (current - obj.settings.size) + "px"}, obj.settings.duration); }); }; function back(obj){ return obj.each(function(){ var current = parseInt($(obj).css("left")); $(this).animate({left: (current + obj.settings.size) + "px"}, obj.settings.duration); }); }; function reset(obj){ return obj.each(function(){ $(this).animate({left: obj.settings.defaultLeft }, obj.settings.duration); }); }; }; })(jQuery); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---