I am sure someone has gone over this but I have had no luck finding some results. I want to know what is the fastest way to maintain a proper variable scope. Here is some example jquery code I wrote this morning.
var oSignup = {
nTopMargin: null,
oBody: $("div#body"),
oSignup: $("div#newsletter_signup"),
oSignupBtn: $("div#newsletter_signup a.btn-s4")
}
oSignup.nTopMargin = Math.abs(oSignup.oSignup.offset().top);
oSignup.oSignupBtn.toggle(function(){
oSignup.oSignup.css({"top":0});
oSignup.oBody.css({"top":oSignup.nTopMargin});
},function(){
oSignup.oSignup.css({"top":-(oSignup.nTopMargin)});
oSignup.oBody.css({"top":0});
});
Is this good or bad practice?