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!

Reply via email to