Difference between revisions of "Template:Vilnius-Lithuania/JS/ContentPage"

m
m
Line 16: Line 16:
 
$(".introContainer .heading").css("margin-top", (35 * scroll) + unit);
 
$(".introContainer .heading").css("margin-top", (35 * scroll) + unit);
  
if (document.getElementById("indexbutton") == undefined) return;
+
// if (document.getElementById("indexbutton") == undefined) return;
let onTextBool = document.getElementById("navbar").getAttribute("onText");
+
// let onTextBool = document.getElementById("navbar").getAttribute("onText");
document.getElementById("indexbutton").setAttribute("onText", onTextBool);
+
// document.getElementById("indexbutton").setAttribute("onText", onTextBool);
 
}
 
}
 
window.addEventListener("scroll", animate, {passive: 1});
 
window.addEventListener("scroll", animate, {passive: 1});

Revision as of 14:21, 6 October 2020

// Set heading text window.addEventListener("load", () => { let text = document.getElementById("headingTitleText").value; document.querySelector(".introContainer div.heading").innerText = text; document.querySelector(".introContainer div.heading.other").innerText = text; });

// Title bubble animation function animate() { let scrollTop = document.body.scrollTop == 0 ? document.documentElement.scrollTop : document.body.scrollTop; let scroll = scrollTop / window.innerHeight; if (scroll > 1) scroll = 1; let unit = "vw"; if (window.innerWidth / window.innerHeight > 1) unit = "vh" $(".introContainer span").css("top", (60 * scroll) + unit); $(".introContainer .heading").css("margin-top", (35 * scroll) + unit);

// if (document.getElementById("indexbutton") == undefined) return; // let onTextBool = document.getElementById("navbar").getAttribute("onText"); // document.getElementById("indexbutton").setAttribute("onText", onTextBool); } window.addEventListener("scroll", animate, {passive: 1}); window.addEventListener("resize", animate, {passive: 1}); document.addEventListener("load", animate, {passive: 1}); animate();