Thanks for replying James. I'm still having some issues. Is there a place where I can read about Plugin scope?
If I am adding settings in by the line you type, how do I access the properties of the object inside the main function? hmmmm On Oct 21, 2:58 pm, James <james.gp....@gmail.com> wrote: > Not with the way your code is currently structured. > You'd have to move the settings variable outside of your function. > Something set to like: > > $.fn.plugin.settings = { ... } > > On Oct 21, 7:28 am, Joel Taylor <joelatay...@gmail.com> wrote: > > > > > Hi, so, I have a pretty basic plugin, and I'm trying to access a > > variable that's set when the plugin is initialized. I'd also like to > > change that variable on the fly. > > > Is it possible? > > > (function($) { > > $.fn.plugin = function(options){ > > // default settings > > var settings = { > > marginLeft : 10, > > identifier : 'om', > > xidentifier : 'omx', > > height : 200, > > width : 200 > > } > > //extending options > > options = options || {}; > > $.extend(settings, options); > > > this.each(function(i){ > > // do something > > }); > > } > > > })(jQuery); > > > $('div').plugin(); > > $('div).data('marginLeft'); ???? > > > Thanks for any help!