CALL OF DUTY
BATTLEFIELD
RAINBOW SIX SIEGE
FORTNITE
ARC Raiders
Destiny 2
Diablo IV
Grand Theft Auto V
/* ======================================
BACK TO TOP
====================================== */
const backToTop =
document.getElementById(
"backToTop"
);
window.addEventListener(
"scroll",
() => {
if(window.scrollY > 300){
backToTop.classList.add(
"show"
);
}else{
backToTop.classList.remove(
"show"
);
}
}
);
backToTop.addEventListener(
"click",
() => {
window.scrollTo({
top:0,
behavior:"smooth"
});
}
);
/* ======================================
INTRO
====================================== */
if(!sessionStorage.getItem("rgnPlayed")){
sessionStorage.setItem(
"rgnPlayed",
"true"
);
setTimeout(()=>{
document.getElementById("r")
.classList.add("rgnShow");
},700);
setTimeout(()=>{
document.getElementById("g")
.classList.add("rgnShow");
},1200);
setTimeout(()=>{
document.getElementById("n")
.classList.add("rgnShow");
},1700);
setTimeout(()=>{
document.getElementById("rgnLine")
.classList.add("rgnLineShow");
},2600);
}else{
const intro =
document.getElementById(
"rgnIntro"
);
if(intro){
intro.remove();
}
}
/* ======================================
SCROLL EFFECT
====================================== */
document.addEventListener(
"DOMContentLoaded",
function(){
if(window.innerWidth < 769){
return;
}
const sections =
document.querySelectorAll(
'.page-section'
);
if(!sections.length){
return;
}
const observer =
new IntersectionObserver(
(entries)=>{
entries.forEach(entry=>{
if(entry.isIntersecting){
entry.target.classList.add(
'rgn-scroll-visible'
);
entry.target.classList.remove(
'rgn-scroll-hidden'
);
observer.unobserve(
entry.target
);
}
});
},
{
threshold:0.08
}
);
sections.forEach(section=>{
section.classList.add(
'rgn-scroll-hidden'
);
observer.observe(section);
});
});