I am working with a jquery plugin that looks like this:
(function($){
var options;
$.fn.main(opts){
options = opts;
//rest of code
}
$.fn.otherFunc(){
//does something with options
}
}(jQuery));
The problem here is that if i use this plugin 5 times on the page, the options variable gets overwritten, and so all 5 instances share those options. This is bad, i want each plugin instance to have its own config.
Is there a non-hackish jQuery way to accomplish this?
edit:
I should add that i would consider addition options to $(this) in $.fn.main as an expando somewhat hackish, because $.fn.otherFunc might not be called on the $(this) from the main function, so i wouldnt have access to my stuff!