I am developing a small JavaScript Framework, I need to know how to add some options to a function, so the user can set his own settings for a particular method.
This is a sample function method i have created
$.prototype = {
setCenter: function() {
this.e.style.position = 'absolute';
this.e.style.top = '50%';
this.e.style.left = '50%';
this.e.style.marginLeft = '-50px';
this.e.style.marginTop = '-50px';
return this;
}
};
I am expecting this to be developed to handle the below options sets.
*I am not using JQuery, I need a pure JavaScript Solution for this. This is an example code, maybe not the real thing , but just get the idea.
$('sampleDiv').setCenter({
animate:true, fade:true
});
Help me solve this problem, i appreciate anyone who tries to answer this. Thank you !