I often go online to download js plug-ins written by experts. Every time I just need to quote js and set the variables, I have never understood the principle (mainly because the code of the experts is too concise-,-).
This time I figured out how to pass and set multiple (many) parameters.
For example, the method is function lunbo(){};
When calling and setting, write:
lunbo({ speed:200, wrapper:'#id', ease:'easing' })
Then, when obtained within the method:
function lunbo(options){ var set=$.extend({},options); var _speed=set.speed; var _wrapper=set.wrapper; var _ease=set.ease; /* 使用获取的参数 */ }
In addition, when there is really no other way, you can set global variables and use them flexibly.