jimsite/main.js
Jim Shepich III 84a2e0a66e Return to template
Old project in the process of being gutted and adapted to a template for my website.
2021-09-28 00:53:49 -04:00

74 lines
2.8 KiB
JavaScript

function id(ID){
return document.getElementById(ID);
}
var navibar = document.getElementsByClassName("navibar");
var pages=document.getElementsByClassName("content");
function iframe(ID,width,height,src,name){
this.ID=ID;
this.width=width;
this.height=height;
this.src=src;
this.type="iframe";
this.name=name;
}
function content(ID,content,name){
this.ID=ID;
this.content=content;
this.name=name;
this.type="content";
}
/*function writecookie(attribute,value){
var d = new Date();
d.setTime(d.getTime() + (1*24*60*60*1000));
var expires = "expires=" + d.toGMTString();
if(document.cookie.indexOf(attribute)>-1){
document.cookie.substring(attribute+"=",document.cookie.substring(attribute+"=",document.cookie.length).indexOf(";"))+value+document.cookie.substring(document.cookie.substring(attribute+"=",document.cookie.length).indexOf(";"),document.cookie.length)+"expires="+d.toGMTString()+";path=/";
} else {
document.cookie=attribute+"="+value+";"+"expires="+d.toGMTString()+";path=/";
}
}*/
id("navibar").addEventListener("mouseenter",function(){id("navibar").style.zIndex=39;
for(i=0;i<document.getElementsByClassName("overlay").length;i++){
document.getElementsByClassName("overlay")[i].style.zIndex=38;
}
});
id("navibar").addEventListener("mouseleave",function(){id("navibar").style.zIndex=38;
for(i=0;i<document.getElementsByClassName("overlay").length;i++){
document.getElementsByClassName("overlay")[i].style.zIndex=39;
}
});
window.addEventListener("mousemove",movecursor);
id("frame").addEventListener("mouseenter",hidecursor);
id("frame").addEventListener("mouseleave",showcursor);
//window.addEventListener("mouseenter",movecursor);
function movecursor(e){
if(window.e){e=window.e;}
id("cursor").style.top=e.clientY-(id("cursor").clientHeight/672)*(76);
id("cursor").style.left=e.clientX-(id("cursor").clientWidth/541)*(134);
}
function hidecursor(){
id("cursor").style.display="none";
}
function showcursor(){
id("cursor").style.display="inline";
}
var topgrad=1;
var bottomgrad=1;
var time=1200;
for(i=0;i<time;i++){
setTimeout(dim,1200*i/(time))
}
function dim(){
topgrad-=2/time;
if(topgrad<=0){
topgrad=0;
}
bottomgrad-=1/time;
console.log("got it");document.getElementById("loading").style.background="linear-gradient(to bottom , rgba(0,0,0,"+topgrad+") , rgba(0,0,0,"+bottomgrad+"))";
document.getElementById("loadingimg").style.opacity=bottomgrad;
}
setTimeout(function(){document.getElementById("loading").parentNode.removeChild(document.getElementById("loading"));},time);