I've been trying to utilise the revealing module pattern, and thought I'd make a function for a non-css3 custom scroll bar.
var sb=(function($){
//Private
var settings=function(props){
return{
wrapper: props.wrapper ? document.getElementById(props.wrapper):null,
thumb: props.thumb ? document.getElementById(props.thumb):null,
track: props.track ? document.getElementById(props.track):null,
left: props.left ? props.left:null,
right: props.right ? props.right:null,
contentWidth: props.contentWidth? props.contentWidth:null
};
};
var LOG=function(input){
console.log(input)
};
//Object Literal
return{
Log:LOG,
settings:settings
};
})(jQuery);
The above is the module. I am setting the values like so:
window.onload=function(){
sb.settings({wrapper:'bodyWrapper',thumb:'thumb',track:'track'});
}
HOWEVER, when I try to test it, I keep getting 'undefined' and other errors. Running console.log(settings.wrapper)
inside the module returns undefined
. I really don't know where I'm going wrong, so any help would be much appreciated. Thanks in advance