javascript - Jquery Plugin Colaboration -


i have code think not essential, more of theoretic question.

lets have plugin generates series of dates in box.

i extending plugin can create in multiple instances what proper format function can use on multiple occasions.

then use scroller plugin scroll in box mouse in case dates exceed size of box.

both plugin code mine can edit part no problem.

where stuck how can pass options change result of plugins if working together. lets generate dates , want scroll them vertically instead of horizontally.

i looking function initiation pattern able pass corresponding secondary function motion - lets scroller function.

one approach add options parameter.

function plugin(opts) {    opts = opts || {};   var defaults = {}; //some default options    //whatever options passed in win   for(key in opts) defaults[key] = opts[key];    //rest of plugin code } 

somewhere else want use new options

plugin({   scroller:true }); 

this approach has advantage don't have pass in options parameter @ all. old code still work if don't modify plug in much.


Comments