mirror of
https://github.com/safing/web
synced 2025-09-02 02:59:03 +00:00
Move foot js into foot partial
This commit is contained in:
parent
86864887c7
commit
b2daee3c8d
2 changed files with 43 additions and 45 deletions
|
@ -0,0 +1,43 @@
|
||||||
|
<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>
|
45
index.html
45
index.html
|
@ -207,50 +207,5 @@ title: Safing
|
||||||
</body>
|
</body>
|
||||||
<foot>
|
<foot>
|
||||||
{% include foot.html %}
|
{% include foot.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>
|
|
||||||
</foot>
|
</foot>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue