I get a console error TypeError: bodys.show is not a function when loading my page. What am I doing wrong?
function loadingScreen(selector,css)
{
this.loadingAnimation = $("<div><p>Loading</p><div></div></div>").appendTo(selector);
this.containerCss = $.extend({'border-radius':"20px",position:"absolute",height:"40px",width:"120px","display":"none"}, css);
this.loadingAnimation.css(this.containerCss);
this.p = this.loadingAnimation.children("p").first();
this.p.css({width:"100%",'text-align':"center"});
this.div = this.loadingAnimation.children("div").first();
this.div.css({position:"abslolute",left:"0",top:"0",'background-color':"rgba(255,100,100,0.5)",height:"100%",width:"10%"});
function show(){
this.loadingAnimation.css("display","block");
animate(this.div,"right");
}
function hide(){
this.loadingAnimation.css("display","none");
this.div.stop(true,true);
this.div.css("margin-left","0px");
}
function animate(element,direction)
{
if(direction === "right"){
element.animate({"margin-left":"120px"},animate(element,"left"));
}
else if(direction === "left"){
element.animate({"margin-left":"0px"},animate(element,"right"));
}
}
}
$(document).ready(function()
{
var bodys = new loadingScreen("body",{});
bodys.show();
});