post header bg scroll if safari

This commit is contained in:
wgroeneveld 2020-05-12 20:48:42 +02:00
parent 90eb10ea7a
commit 25a2c2dfa2
3 changed files with 130 additions and 119 deletions

View File

@ -13,7 +13,7 @@
"@babel/preset-env": "^7.9.6"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "/usr/local/bin/hugo"
},
"repository": {
"type": "git",

View File

@ -1,5 +1,7 @@
(function() {
// from swift theme: sandwich
// ******
function modifyClass(el, targetClass) {
if (isObj(el) && targetClass) {
const elClass = el.classList;
@ -33,8 +35,7 @@
elClass.contains(targetClass) ? false : elClass.add(targetClass);
}
}
// from swift theme: sandwich
// ******
(function() {
let bar = 'nav_bar-wrap';
let navBar = elem(`.${bar}`);
@ -71,7 +72,6 @@
})();
(function postsPager(){
const pager = elem('.pagination');
if (pager) {
@ -90,7 +90,9 @@
});
}
})();
// ******
(function() {
var fbposts = document.querySelector('#fbposts');
function whoops(error) {
console.log(error);
@ -119,6 +121,18 @@
whoops(e);
}
}
if(fbposts && window.fbtoken) {
window.fbAsyncInit = getRedZuurdesemFacebookFeed;
}
})()
function fromFixedToScrollForSafari() {
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
const header = document.querySelector('.post_header');
if(isSafari) {
header.style.backgroundAttachment = 'scroll';
}
}
function fbCommunityHeaderify() {
var elem = document.querySelector('#fb-community-header');
@ -155,9 +169,7 @@
elem.innerHTML = '<div class="fb-page" data-width="' + vw + '" data-href="https://www.facebook.com/redzuurdesem" data-hide-cover="false" data-tabs="timeline,messages" data-show-facepile="false"></div>';
}
if(fbposts && window.fbtoken) {
window.fbAsyncInit = getRedZuurdesemFacebookFeed;
}
fbCommunityHeaderify();
fbCommunityContainer();
fromFixedToScrollForSafari();
})()

View File

@ -65,8 +65,7 @@
background-size: cover
background-repeat: no-repeat
background-position: center
background-attachment: fixed;
background-attachment: fixed
position: relative
height: 48vh