mirror of
https://github.com/safing/web
synced 2025-09-01 18:49:06 +00:00
43 lines
1.5 KiB
HTML
43 lines
1.5 KiB
HTML
<script type="text/javascript">
|
|
// fix content on mobile browsers that change vh if the top bar disappears
|
|
function ready(fn) {
|
|
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
|
|
fn();
|
|
} else {
|
|
document.addEventListener('DOMContentLoaded', fn);
|
|
}
|
|
}
|
|
|
|
var lastWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
|
|
|
|
function bannerResize() {
|
|
var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
|
|
document.getElementById("banner-background").style.height = h + "px"
|
|
document.getElementById("banner-transition").style.height = h + "px"
|
|
document.getElementById("banner-content").style.height = Math.floor(h*1.1) + "px"
|
|
}
|
|
|
|
function bannerResizer() {
|
|
// fix content on mobile browsers that change vh if the top bar disappears
|
|
var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
|
|
if (w != lastWidth) {
|
|
lastWidth = w
|
|
bannerResize()
|
|
}
|
|
}
|
|
|
|
function scrollToPM(event){
|
|
event.preventDefault()
|
|
document.getElementById("portmaster").scrollIntoView({
|
|
behavior: 'smooth'
|
|
})
|
|
}
|
|
|
|
ready(function(){
|
|
window.addEventListener("resize", bannerResizer);
|
|
bannerResize()
|
|
|
|
document.getElementById("learnmore-button").addEventListener("click", scrollToPM)
|
|
document.getElementById("learnmore-icon").addEventListener("click", scrollToPM)
|
|
})
|
|
</script>
|