// Prevent default function
function preventDefault(e) {
e.preventDefault();
}
// Check device type
const isMac = navigator.platform.toLowerCase().indexOf('mac') !== -1;
const isIpad = navigator.platform.toLowerCase().indexOf('ipad') !== -1;
const isIphone = navigator.platform.toLowerCase().indexOf('iphone') !== -1;
if (isMac || isIpad || isIphone) {
document.body.classList.add('apple');
if (isMac) {
document.body.classList.add('-macbook');
}
if (isIpad) {
document.body.classList.add('-ipad');
}
if (isIphone) {
document.body.classList.add('-iphone');
}
}
// Check device size
let isPc = window.innerWidth > 1260;
let isSmallPc = window.innerWidth > 1024 && window.innerWidth <= 1260;
let isTablet = window.innerWidth > 760 && window.innerWidth <= 1260;
let isMobile = window.innerWidth <= 760;
function checkDeviceSize() {
isPc = window.innerWidth > 1260;
isTablet = window.innerWidth > 760 && window.innerWidth <= 1260;
isMobile = window.innerWidth <= 760;
}
window.addEventListener('resize', checkDeviceSize);
// Set CSS variable with window.innerHeight
function setCssWindowInnerHeight() {
document.documentElement.style.setProperty(
"--window-inner-height",
`${window.innerHeight}px`
);
}
function setFixedCssWindowInnerHeight() {
document.documentElement.style.setProperty(
"--window-inner-height-fixed",
`${window.innerHeight}px`
);
}
window.addEventListener("DOMContentLoaded", setFixedCssWindowInnerHeight);
window.addEventListener("DOMContentLoaded", setCssWindowInnerHeight);
window.addEventListener("resize", setCssWindowInnerHeight);