first commit
This commit is contained in:
43
src/common/countdown.js
Normal file
43
src/common/countdown.js
Normal file
@ -0,0 +1,43 @@
|
||||
export default function Countdown() {
|
||||
|
||||
document.addEventListener('readystatechange', event => {
|
||||
if (event.target.readyState === "complete") {
|
||||
var clockdiv = document.getElementsByClassName("clockdiv");
|
||||
var countDownDate = new Array();
|
||||
for (var i = 0; i < clockdiv.length; i++) {
|
||||
countDownDate[i] = new Array();
|
||||
countDownDate[i]['el'] = clockdiv[i];
|
||||
countDownDate[i]['time'] = new Date(clockdiv[i].getAttribute('data-date')).getTime();
|
||||
countDownDate[i]['days'] = 0;
|
||||
countDownDate[i]['hours'] = 0;
|
||||
countDownDate[i]['seconds'] = 0;
|
||||
countDownDate[i]['minutes'] = 0;
|
||||
}
|
||||
|
||||
var countdownfunction = setInterval(function () {
|
||||
for (var i = 0; i < countDownDate.length; i++) {
|
||||
var now = new Date().getTime();
|
||||
var distance = countDownDate[i]['time'] - now;
|
||||
countDownDate[i]['days'] = Math.floor(distance / (1000 * 60 * 60 * 24));
|
||||
countDownDate[i]['hours'] = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
countDownDate[i]['minutes'] = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||
countDownDate[i]['seconds'] = Math.floor((distance % (1000 * 60)) / 1000);
|
||||
|
||||
if (distance < 0) {
|
||||
countDownDate[i]['el'].querySelector('.days').innerHTML = 0;
|
||||
countDownDate[i]['el'].querySelector('.hours').innerHTML = 0;
|
||||
countDownDate[i]['el'].querySelector('.minutes').innerHTML = 0;
|
||||
countDownDate[i]['el'].querySelector('.seconds').innerHTML = 0;
|
||||
} else {
|
||||
countDownDate[i]['el'].querySelector('.days').innerHTML = countDownDate[i]['days'];
|
||||
countDownDate[i]['el'].querySelector('.hours').innerHTML = countDownDate[i]['hours'];
|
||||
countDownDate[i]['el'].querySelector('.minutes').innerHTML = countDownDate[i]['minutes'];
|
||||
countDownDate[i]['el'].querySelector('.seconds').innerHTML = countDownDate[i]['seconds'];
|
||||
}
|
||||
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
17
src/common/fixStylesheetsOrder.js
Normal file
17
src/common/fixStylesheetsOrder.js
Normal file
@ -0,0 +1,17 @@
|
||||
export function fixRtlStylesheetsOrder() {
|
||||
const bootstrap_rtl = document.head.querySelector('link[href="/assets/css/lib/bootstrap.rtl.min.css"]');
|
||||
const style_css = document.head.querySelector('link[href="/assets/css/style.css"]');
|
||||
const style_rtl_css = document.head.querySelector('link[href="/assets/css/rtl_style.css"]');
|
||||
bootstrap_rtl && document.head.append(bootstrap_rtl);
|
||||
style_css && document.head.append(style_css);
|
||||
style_rtl_css && document.head.append(style_rtl_css);
|
||||
}
|
||||
|
||||
export function fixPreviewStylesheetOrder() {
|
||||
const bootstrap_css = document.head.querySelector('link[href="/assets/css/lib/bootstrap.min.css"]');
|
||||
const style_css = document.head.querySelector('link[href="/assets/css/style.css"]');
|
||||
const preview_css = document.head.querySelector('link[href="/landing-preview/css/preview-style.css"]');
|
||||
bootstrap_css && document.head.append(bootstrap_css);
|
||||
style_css && document.head.append(style_css);
|
||||
preview_css && document.head.append(preview_css);
|
||||
}
|
||||
19
src/common/loadingPace.js
Normal file
19
src/common/loadingPace.js
Normal file
@ -0,0 +1,19 @@
|
||||
const loadingPace = () => {
|
||||
let preloader = document.querySelector("#preloader");
|
||||
|
||||
if (!preloader) return;
|
||||
|
||||
if (document.body.classList.contains("pace-done")) preloader.classList.add("isdone");
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
preloader.classList.add("isdone")
|
||||
});
|
||||
|
||||
if (typeof window.Pace === 'undefined') return;
|
||||
|
||||
window.Pace.on("start", () => preloader.classList.remove("isdone"));
|
||||
|
||||
window.Pace.on("done", () => preloader.classList.add("isdone"));
|
||||
}
|
||||
|
||||
export default loadingPace
|
||||
21
src/common/navbarScrollEffect.js
Normal file
21
src/common/navbarScrollEffect.js
Normal file
@ -0,0 +1,21 @@
|
||||
export default function navbarScroll(navbar, isTransparent, isFaqPage) {
|
||||
if (!navbar) return;
|
||||
|
||||
if (window.pageYOffset > 300) {
|
||||
navbar.classList.add("nav-scroll");
|
||||
if (isTransparent) navbar.classList.remove("bg-transparent");
|
||||
} else {
|
||||
navbar.classList.remove("nav-scroll");
|
||||
if (isTransparent) navbar.classList.add("bg-transparent");
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
if (window.pageYOffset > 300) {
|
||||
navbar.classList.add("nav-scroll");
|
||||
if (isTransparent) navbar.classList.remove("bg-transparent");
|
||||
} else {
|
||||
navbar.classList.remove("nav-scroll");
|
||||
if (isTransparent) navbar.classList.add("bg-transparent");
|
||||
}
|
||||
});
|
||||
}
|
||||
16
src/common/parallaxie.js
Normal file
16
src/common/parallaxie.js
Normal file
@ -0,0 +1,16 @@
|
||||
export default function parallaxie(selector) {
|
||||
let elementBg = document.querySelector(selector);
|
||||
let image = elementBg.getAttribute("data-background");
|
||||
let position = elementBg.getBoundingClientRect().top * 0.55;
|
||||
|
||||
elementBg.style.backgroundImage = `url("${image}")`;
|
||||
elementBg.style.backgroundSize = 'cover';
|
||||
elementBg.style.backgroundRepeat = 'no-repeat';
|
||||
elementBg.style.backgroundAttachment = 'fixed';
|
||||
elementBg.style.backgroundPosition = `center ${position}px`;
|
||||
|
||||
window.addEventListener("scorll", () => {
|
||||
position = elementBg.getBoundingClientRect().top * 0.55;
|
||||
elementBg.style.backgroundPosition = `center ${position}px`;
|
||||
});
|
||||
}
|
||||
8
src/common/removeSlashFromPagination.js
Normal file
8
src/common/removeSlashFromPagination.js
Normal file
@ -0,0 +1,8 @@
|
||||
const removeSlashFromPagination = () => {
|
||||
let swiperPagination = document.querySelector(".swiper-pagination");
|
||||
if (swiperPagination) {
|
||||
swiperPagination.innerHTML = swiperPagination.innerHTML.replace(" / ", "");
|
||||
}
|
||||
};
|
||||
|
||||
export default removeSlashFromPagination;
|
||||
11
src/common/scrollToSection.js
Normal file
11
src/common/scrollToSection.js
Normal file
@ -0,0 +1,11 @@
|
||||
export default function scrollToSection(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const section = document.querySelector('[data-scroll-index="' + event.target.dataset.scrollNav + '"]');
|
||||
|
||||
if (section) {
|
||||
setTimeout(() => {
|
||||
section.scrollIntoView({ behavior: 'smooth' });
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
20
src/common/scrollToTop.js
Normal file
20
src/common/scrollToTop.js
Normal file
@ -0,0 +1,20 @@
|
||||
export default function scrollToTop() {
|
||||
const toTop = document.querySelector(".to_top");
|
||||
|
||||
if (!toTop) return;
|
||||
|
||||
window.addEventListener("scroll", function() {
|
||||
var bodyScroll = window.scrollY;
|
||||
|
||||
if (bodyScroll > 700) {
|
||||
toTop.classList.add("show");
|
||||
} else {
|
||||
toTop.classList.remove("show");
|
||||
}
|
||||
});
|
||||
|
||||
toTop.addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
});
|
||||
}
|
||||
20
src/common/timer.js
Normal file
20
src/common/timer.js
Normal file
@ -0,0 +1,20 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
export default function timer(date) {
|
||||
const second = 1000;
|
||||
const minute = second * 60;
|
||||
const hour = minute * 60;
|
||||
const day = hour * 24;
|
||||
// const week = hour * 24 * 7;
|
||||
|
||||
let countDown = new Date(date).getTime();
|
||||
|
||||
let x = setInterval(function () {
|
||||
let now = new Date().getTime()
|
||||
let distance = countDown - now;
|
||||
|
||||
document.getElementById('days').innerText = Math.floor(distance / (day));
|
||||
document.getElementById('hours').innerText = Math.floor((distance % (day)) / (hour));
|
||||
document.getElementById('minutes').innerText = Math.floor((distance % (hour)) / (minute));
|
||||
document.getElementById('seconds').innerText = Math.floor((distance % (minute)) / second);
|
||||
}, second)
|
||||
}
|
||||
Reference in New Issue
Block a user