Initial commit

This commit is contained in:
Marek Lesko
2025-08-05 10:59:30 +02:00
commit 0019c5c601
835 changed files with 426250 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
// style controllers
const controllerStyle = (accordionController, isActive) => {
const rotateAbleLine = accordionController.querySelectorAll("span")[1];
if (rotateAbleLine) {
rotateAbleLine.style.transform = !isActive
? "rotate(0deg)"
: "rotate(90deg)";
}
};
// accordion hide and show
const toggleAccordion = (accordion, isActive, currentIndex, index) => {
const parentContent = accordion.closest(".accordion-content");
const content = accordion.querySelector(".accordion-content");
const contentWrapper = accordion.querySelector(".content-wrapper");
const contentHeight = contentWrapper.offsetHeight;
let contenStyleHeight = content.style.height;
if (contenStyleHeight === "auto") {
content.style.height = `${contentHeight}px`;
}
setTimeout(() => {
content.style.height = !isActive ? `${contentHeight}px` : 0;
}, 1);
if (!isActive) {
setTimeout(() => {
if (!parentContent) {
content.style.height = `auto`;
}
}, 500);
}
};
// get accordion controller and listen click event
const accordionController = (accordionContainer) => {
const groupOfAccordion = accordionContainer.querySelectorAll(".accordion");
groupOfAccordion.forEach((accordion, idx) => {
const accordionController = accordion.querySelector(
".accordion-controller"
);
const isInitialyActive = accordion.classList.contains("active");
if (isInitialyActive) {
const contents = accordion.querySelector(".accordion-content");
const contentHeight = contents.children[0].offsetHeight;
if (contentHeight) {
contents.style.height = `${contentHeight}px`;
}
}
if (accordionController) {
accordionController.addEventListener("click", function () {
const currentAccordion = this.closest(".accordion");
const isActive = currentAccordion.classList.contains("active");
let waitForDblClick = setTimeout(() => {
groupOfAccordion.forEach((accordion, idx1) => {
const isAccordionController = accordion.querySelector(
".accordion-controller"
);
if (isAccordionController) {
accordion.classList.remove("active");
const accordionController = accordion.querySelector(
".accordion-controller"
);
controllerStyle(accordionController, true);
toggleAccordion(accordion, true, idx, idx1);
}
});
if (!isActive) {
currentAccordion.classList.add("active");
controllerStyle(accordionController, false);
toggleAccordion(currentAccordion, false);
}
}, 10);
accordionController.addEventListener("dblclick", function () {
clearTimeout(waitForDblClick);
});
});
}
});
};
const accordions = () => {
const accordionContainers = document.querySelectorAll(".accordion-container");
if (!accordionContainers.length) {
return;
}
accordionContainers.forEach((accordionContainer) => {
accordionController(accordionContainer);
});
};

View File

@@ -0,0 +1,33 @@
const count = () => {
const countContainers = document.querySelectorAll(".count-container");
if (!count) {
return;
}
countContainers.forEach((countContainer) => {
const countIput = countContainer.querySelector("input");
const minCount = countContainer.querySelector(".mincount");
const maxCount = countContainer.querySelector(".maxcount");
minCount.addEventListener("click", () => {
let currentValue = parseInt(countIput.value);
if (currentValue === 0 || currentValue < 0) {
if (currentValue === 0) {
currentValue = 1;
} else {
currentValue = 0;
}
} else {
currentValue--;
}
countIput.value = currentValue;
});
maxCount.addEventListener("click", () => {
let currentValue = parseInt(countIput.value);
currentValue++;
countIput.value = currentValue;
});
});
};

View File

@@ -0,0 +1,74 @@
const countDown = () => {
// Set the target date for the countdown (change it to your desired end date)
const coundownContainers = document.querySelectorAll("[data-countdown]");
if (coundownContainers?.length) {
let countdownInterval;
coundownContainers.forEach((coundownContainer) => {
const countDownFields = [...coundownContainer.children];
const targetDateArray = coundownContainer
.getAttribute("data-countdown")
.split("/");
const targetDate = new Date(
`${targetDateArray[0]}-${targetDateArray[1]}-${targetDateArray[2]}T00:00:00`
).getTime();
// Update the countdown every second
countdownInterval = setInterval(
() => updateCountdown(targetDate, countDownFields),
1000
);
});
function updateCountdown(targetDate, countDownFields) {
// Get the current date and time
const currentDate = new Date().getTime();
// Calculate the remaining time
const timeDifference = targetDate - currentDate;
// Calculate days, hours, minutes, and seconds
const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
const hours = Math.floor(
(timeDifference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
const minutes = Math.floor(
(timeDifference % (1000 * 60 * 60)) / (1000 * 60)
);
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
// Display the countdown
countDownFields.forEach((countDownField, ind) => {
countDownField.querySelector(".count").innerHTML =
ind === 0
? days > 9
? days
: `0${days}`
: ind === 1
? hours > 9
? hours
: `0${hours}`
: ind === 2
? minutes > 9
? minutes
: `0${minutes}`
: seconds > 9
? seconds
: `0${seconds}`;
});
// If the countdown is finished, clear the interval
if (timeDifference < 0) {
clearInterval(countdownInterval);
// document.getElementById("countdown").innerHTML = "Countdown expired!";
// Display the countdown
countDownFields.forEach((countDownField, ind) => {
countDownField.querySelector(".count").innerHTML =
ind === 0 ? `00` : ind === 1 ? `00` : ind === 2 ? `00` : `00`;
});
}
}
}
};

View File

@@ -0,0 +1,82 @@
class countUp {
constructor(el) {
this.el = el;
this.setVars();
this.init();
}
setVars() {
this.number = this.el.querySelectorAll("[data-countup-number]");
this.observerOptions = { root: null, rootMargin: "0px 0px", threshold: 0 };
this.observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
const end = parseFloat(
entry.target.dataset.countupNumber.replace(/,/g, "")
);
const decimals = this.countDecimals(end);
if (entry.isIntersecting) {
this.iterateValue(entry.target, end, decimals);
}
});
}, this.observerOptions);
}
init() {
if (this.number.length > 0) {
this.number.forEach((el) => {
this.observer.observe(el);
});
}
}
iterateValue(el, end, decimals) {
const start = 0;
const duration = 2500;
let startTimestamp = null;
const step = (timestamp) => {
if (!startTimestamp) startTimestamp = timestamp;
const elapsedPercent = (timestamp - startTimestamp) / duration;
const easedProgress = Math.min(this.easeOutQuint(elapsedPercent), 1);
let interimNumber = Math.abs(easedProgress * (end - start) + start);
el.innerHTML = this.formatNumber(interimNumber, decimals);
if (easedProgress < 1) {
window.requestAnimationFrame(step);
}
};
// requestAnimationFrame returns DOMHighResTimeStamp as a callback (used as timestamp)
window.requestAnimationFrame(step);
}
easeOutQuad(x) {
return 1 - Math.pow(1 - x, 3);
}
easeOutQuint(x) {
return 1 - Math.pow(1 - x, 5);
}
countDecimals(val) {
if (Math.floor(val) === val) return 0;
return val.toString().split(".")[1].length || 0;
}
formatNumber(val, decimals) {
return val.toLocaleString("en-US", {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
});
}
}
// Simplifed version of Viget dynamic modules to attach instances for this demo
// https://www.viget.com/articles/how-does-viget-javascript/
// You CAN use this pattern, but it's single purpose right now
const dataModules = [...document.querySelectorAll('[data-module="countup"]')];
dataModules.forEach((element) => {
element.dataset.module.split(" ").forEach(function () {
new countUp(element);
});
});

View File

@@ -0,0 +1,41 @@
// open drawer
const handleOpen = (drawer, drawerShow) => {
const drawerContainer = drawer.parentNode;
drawerShow.addEventListener("click", () => {
const mobileControllerIcon = drawerShow.querySelector(".utilize-toggle");
if (mobileControllerIcon) {
mobileControllerIcon.classList.toggle("close");
}
drawerContainer.classList.add("active");
});
};
// close drawer
const handleClose = (drawer, drawerShow, closedrawer) => {
const drawerContainer = drawer.parentNode;
closedrawer.addEventListener("click", () => {
drawerContainer.classList.remove("active");
const mobileControllerIcon = drawerShow.querySelector(".utilize-toggle");
if (mobileControllerIcon) {
mobileControllerIcon.classList.toggle("close");
}
});
};
// controll mobile menu
const drawer = () => {
const drawerShowButtons = document.querySelectorAll(".show-drawer");
const drawers = document.querySelectorAll(".drawer");
if (drawerShowButtons?.length) {
drawerShowButtons.forEach((drawerShow, idx) => {
const drawer = drawers[idx];
if (drawer) {
const darawerContainer = drawer.parentNode;
handleOpen(drawer, drawerShow);
const closedrawers = darawerContainer.querySelectorAll(".close-drawer");
closedrawers?.forEach((closedrawer) => {
handleClose(drawer, drawerShow, closedrawer);
});
}
});
}
};

View File

@@ -0,0 +1,59 @@
// tab controller
const filter = () => {
//isotop
var grid = document.querySelector(".filter-contents");
if (grid) {
var iso = new Isotope(grid, {
// options...
itemSelector: ".grid-item",
percentPosition: true,
masonry: {
columnWidth: ".grid-item",
},
});
// filter functions
var filterFns = {
// show if number is greater than 50
numberGreaterThan50: function (itemElem) {
var number = itemElem.querySelector(".number").textContent;
return parseInt(number, 10) > 50;
},
// show if name ends with -ium
ium: function (itemElem) {
var name = itemElem.querySelector(".name").textContent;
return name.match(/ium$/);
},
};
// bind filter button click
var filtersElem = document.querySelector(".filters-button-group");
filtersElem.addEventListener("click", function (event) {
// only work with buttons
if (!matchesSelector(event.target, "button")) {
return;
}
var filterValue = event.target.getAttribute("data-filter");
// use matching filter function
filterValue = filterFns[filterValue] || filterValue;
iso.arrange({ filter: filterValue });
});
// change is-checked class on buttons
var buttonGroups = document.querySelectorAll(".button-group");
for (var i = 0, len = buttonGroups.length; i < len; i++) {
var buttonGroup = buttonGroups[i];
radioButtonGroup(buttonGroup);
}
function radioButtonGroup(buttonGroup) {
buttonGroup.addEventListener("click", function (event) {
// only work with buttons
if (!matchesSelector(event.target, "button")) {
return;
}
buttonGroup.querySelector(".is-checked").classList.remove("is-checked");
event.target.classList.add("is-checked");
});
}
}
};

2925
quarter/assets/js/glightbox.min.js vendored Normal file

File diff suppressed because it is too large Load Diff

1810
quarter/assets/js/isotope.pkgd.min.js vendored Normal file

File diff suppressed because it is too large Load Diff

119
quarter/assets/js/main.js Normal file
View File

@@ -0,0 +1,119 @@
// sticky hedder
stickystickyHeader();
// search controller
search();
// mobile menu
drawer();
// accordion
accordions();
// slider js
silder();
// counter up
const counters = document.querySelectorAll(".counter");
counters.forEach((counter) => {
new countUp(counter);
});
// service cards
service();
// nice select
const selects = document.querySelectorAll(".selectize");
if (selects?.length) {
selects.forEach((select) => NiceSelect.bind(select));
}
// quick view modal
modal();
// tab
tabsController();
//glightbox
GLightbox({
touchNavigation: true,
loop: true,
autoplayVideos: false,
selector: ".glightbox",
slideEffect: "fade",
videosWidth: "800px",
});
GLightbox({
touchNavigation: true,
loop: true,
autoplayVideos: false,
selector: ".glightbox2",
slideEffect: "fade",
videosWidth: "800px",
});
GLightbox({
touchNavigation: true,
loop: true,
autoplayVideos: false,
selector: ".glightbox3",
slideEffect: "fade",
videosWidth: "800px",
});
// scrollUp
scrollUp();
// smooth scroll
smoothScroll();
// appart card hover action
const apartCards = document.querySelectorAll(".apart-card");
if (apartCards?.length) {
apartCards.forEach((apartCard, idx) => {
apartCard.addEventListener("mouseenter", () => {
apartCard.querySelector(".card-quick-area").classList.add("active");
});
});
}
// isotop filters
filter();
// nice checkbox
nice_checkbox();
// count input
count();
// countdown
const countContainers = document.querySelectorAll(".countdown");
if (countContainers?.length) {
countDown();
}
// price slider
const range_sliders = document.querySelectorAll(".slider-range");
if (range_sliders?.length) {
$(".slider-range").slider({
range: true,
min: 50,
max: 5000,
values: [50, 1500],
slide: function (event, ui) {
$(".amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
},
});
$(".amount").val(
"$" +
$(".slider-range").slider("values", 0) +
" - $" +
$(".slider-range").slider("values", 1)
);
}
// price

View File

@@ -0,0 +1,196 @@
$(function () {
var LocsA = [
{
lat: 40.740178,
lon: -74.190194,
title: "Location 1",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/1.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.733617,
lon: -74.17115,
title: "Location 2",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/2.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.743011,
lon: -74.2471,
title: "Location 3",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/3.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.71115,
lon: -74.214998,
title: "Location 4",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/4.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.69001,
lon: -74.151753,
title: "Location 5",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/5.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.69759,
lon: -74.263164,
title: "Location 6",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/6.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.729979,
lon: -74.271992,
title: "Location 7",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/1.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.749702,
lon: -74.163631,
title: "Location 8",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/2.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.718971,
lon: -74.323219,
title: "Location 9",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/3.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.74835,
lon: -74.323219,
title: "Location 10",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/4.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
{
lat: 40.740178,
lon: -74.190194,
title: "Location 11",
html: [
'<div class="map-product-item">',
'<a href="#"><img src="./assets/img/product-3/5.jpg" alt="#"></a>',
'<h5 class="ltn__map-product-title"><a href="#">House in Upper East Side</a></h5>',
'<h5 class="ltn__map-product-price">$30,000</h5>',
'<p class="ltn__map-product-info"><span>3 Bed</span><span>3 Bath</span><span>1220 ft<sup>2</sup></span></p>',
'<p class="ltn__map-product-location"><i class="flaticon-pin"></i>Boston, New York</span>',
"</div>",
].join(""),
icon: "../assets/img/icons/map-marker-2.png",
animation: google.maps.Animation.BOUNCE,
},
];
new Maplace({
locations: LocsA,
controls_on_map: true,
map_options: {
zoom: 13,
scrollwheel: false,
stopover: true,
},
stroke_options: {
strokeColor: "#f10",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#f10",
fillOpacity: 0.4,
},
}).Load();
});

7340
quarter/assets/js/maplace.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
const modal = () => {
const modalContainers = document.querySelectorAll(".modal-container");
if (!modalContainers.length) {
return;
}
modalContainers.forEach((modalContainer) => {
const body = document.body;
const bodyStyle = body.style;
const modals = modalContainer.querySelectorAll(".modal");
modals?.forEach((modal, idx) => {
const modalOpens = modalContainer.querySelectorAll(
`[data-modal-index="${idx + 1}"]`
);
const modalContent = modal.querySelector(".modal-content");
const modalCloses = modal.querySelectorAll(".modal-close");
// open modal
modalOpens.forEach((modalOpen) => {
modalOpen.addEventListener("click", () => {
modal.style.display = "block";
bodyStyle.overflow = "hidden";
bodyStyle.paddingRight = "17px";
setTimeout(() => {
// uncomment if you need body to be scroll down with modal open
// window.scroll({ top: window.scrollY - 100, behavior: "smooth" });
modal.style.opacity = 100;
modal.style.visibility = "visible";
modal.scrollTop = 0;
modalContent.style.transform = "translateY(0px)";
}, 10);
});
});
// close modal
modalCloses.forEach((modalClose) => {
modalClose.addEventListener("click", function () {
modal.style.opacity = 0;
modal.style.visibility = "hidden";
modalContent.style.transform = `translateY(-${80}px)`;
setTimeout(() => {
modal.style.display = "none";
bodyStyle.overflow = "auto";
bodyStyle.paddingRight = 0;
}, 500);
});
});
});
});
};

View File

@@ -0,0 +1,402 @@
!(function (e, t) {
"object" == typeof exports && "object" == typeof module
? (module.exports = t())
: "function" == typeof define && define.amd
? define([], t)
: "object" == typeof exports
? (exports.NiceSelect = t())
: (e.NiceSelect = t());
})(self, () =>
(() => {
"use strict";
var e = {
d: (t, i) => {
for (var s in i)
e.o(i, s) &&
!e.o(t, s) &&
Object.defineProperty(t, s, { enumerable: !0, get: i[s] });
},
o: (e, t) => Object.prototype.hasOwnProperty.call(e, t),
r: (e) => {
"undefined" != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }),
Object.defineProperty(e, "__esModule", { value: !0 });
},
},
t = {};
function i(e) {
var t = document.createEvent("MouseEvents");
t.initEvent("click", !0, !1), e.dispatchEvent(t);
}
function s(e) {
var t = document.createEvent("HTMLEvents");
t.initEvent("change", !0, !1), e.dispatchEvent(t);
}
function o(e) {
var t = document.createEvent("FocusEvent");
t.initEvent("focusin", !0, !1), e.dispatchEvent(t);
}
function n(e) {
var t = document.createEvent("FocusEvent");
t.initEvent("focusout", !0, !1), e.dispatchEvent(t);
}
function d(e) {
var t = document.createEvent("UIEvent");
t.initEvent("modalclose", !0, !1), e.dispatchEvent(t);
}
function l(e, t) {
"invalid" == t
? (c(this.dropdown, "invalid"), h(this.dropdown, "valid"))
: (c(this.dropdown, "valid"), h(this.dropdown, "invalid"));
}
function r(e, t) {
return null != e[t] ? e[t] : e.getAttribute(t);
}
function a(e, t) {
return !!e && e.classList.contains(t);
}
function c(e, t) {
if (e) return e.classList.add(t);
}
function h(e, t) {
if (e) return e.classList.remove(t);
}
e.r(t), e.d(t, { bind: () => f, default: () => u });
var p = { data: null, searchable: !1, showSelectedItems: !1 };
function u(e, t) {
(this.el = e),
(this.config = Object.assign({}, p, t || {})),
(this.data = this.config.data),
(this.selectedOptions = []),
(this.placeholder =
r(this.el, "placeholder") ||
this.config.placeholder ||
"Select an option"),
(this.searchtext =
r(this.el, "searchtext") || this.config.searchtext || "Search"),
(this.selectedtext =
r(this.el, "selectedtext") || this.config.selectedtext || "selected"),
(this.dropdown = null),
(this.multiple = r(this.el, "multiple")),
(this.disabled = r(this.el, "disabled")),
this.create();
}
function f(e, t) {
return new u(e, t);
}
return (
(u.prototype.create = function () {
(this.el.style.opacity = "0"),
(this.el.style.width = "0"),
(this.el.style.padding = "0"),
(this.el.style.height = "0"),
this.data ? this.processData(this.data) : this.extractData(),
this.renderDropdown(),
this.bindEvent();
}),
(u.prototype.processData = function (e) {
var t = [];
e.forEach((e) => {
t.push({
data: e,
attributes: {
selected: !!e.selected,
disabled: !!e.disabled,
optgroup: "optgroup" == e.value,
},
});
}),
(this.options = t);
}),
(u.prototype.extractData = function () {
var e = this.el.querySelectorAll("option,optgroup"),
t = [],
i = [],
s = [];
e.forEach((e) => {
if ("OPTGROUP" == e.tagName)
var s = { text: e.label, value: "optgroup" };
else
s = {
text: e.innerText,
value: e.value,
selected:
null != e.getAttribute("selected") || this.el.value == e.value,
disabled: null != e.getAttribute("disabled"),
};
var o = {
selected: e.selected,
disabled: e.disabled,
optgroup: "OPTGROUP" == e.tagName,
};
t.push(s), i.push({ data: s, attributes: o });
}),
(this.data = t),
(this.options = i),
this.options.forEach((e) => {
e.attributes.selected && s.push(e);
}),
(this.selectedOptions = s);
}),
(u.prototype.renderDropdown = function () {
var e = [
"nice-select",
r(this.el, "class") || "",
this.disabled ? "disabled" : "",
this.multiple ? "has-multiple" : "",
];
let t = '<div class="nice-select-search-box">';
(t += `<input type="text" class="nice-select-search" placeholder="${this.searchtext}..." title="search">`),
(t += "</div>");
var i = `<div class="${e.join(" ")}" tabindex="${
this.disabled ? null : 0
}">`;
(i += `<span class="${
this.multiple ? "multiple-options" : "current"
}"></span>`),
(i += '<div class="nice-select-dropdown">'),
(i += `${this.config.searchable ? t : ""}`),
(i += '<ul class="list"></ul>'),
(i += "</div>"),
(i += "</div>"),
this.el.insertAdjacentHTML("afterend", i),
(this.dropdown = this.el.nextElementSibling),
this._renderSelectedItems(),
this._renderItems();
}),
(u.prototype._renderSelectedItems = function () {
if (this.multiple) {
var e = "";
this.config.showSelectedItems ||
this.config.showSelectedItems ||
"auto" == window.getComputedStyle(this.dropdown).width ||
this.selectedOptions.length < 2
? (this.selectedOptions.forEach(function (t) {
e += `<span class="current">${t.data.text}</span>`;
}),
(e = "" == e ? this.placeholder : e))
: (e = this.selectedOptions.length + " " + this.selectedtext),
(this.dropdown.querySelector(".multiple-options").innerHTML = e);
} else {
var t =
this.selectedOptions.length > 0
? this.selectedOptions[0].data.text
: this.placeholder;
this.dropdown.querySelector(".current").innerHTML = t;
}
}),
(u.prototype._renderItems = function () {
var e = this.dropdown.querySelector("ul");
this.options.forEach((t) => {
e.appendChild(this._renderItem(t));
});
}),
(u.prototype._renderItem = function (e) {
var t = document.createElement("li");
if (((t.innerHTML = e.data.text), e.attributes.optgroup))
c(t, "optgroup");
else {
t.setAttribute("data-value", e.data.value);
var i = [
"option",
e.attributes.selected ? "selected" : null,
e.attributes.disabled ? "disabled" : null,
];
t.addEventListener("click", this._onItemClicked.bind(this, e)),
t.classList.add(...i);
}
return (e.element = t), t;
}),
(u.prototype.update = function () {
if ((this.extractData(), this.dropdown)) {
var e = a(this.dropdown, "open");
this.dropdown.parentNode.removeChild(this.dropdown),
this.create(),
e && i(this.dropdown);
}
r(this.el, "disabled") ? this.disable() : this.enable();
}),
(u.prototype.disable = function () {
this.disabled || ((this.disabled = !0), c(this.dropdown, "disabled"));
}),
(u.prototype.enable = function () {
this.disabled && ((this.disabled = !1), h(this.dropdown, "disabled"));
}),
(u.prototype.clear = function () {
this.resetSelectValue(),
(this.selectedOptions = []),
this._renderSelectedItems(),
this.update(),
s(this.el);
}),
(u.prototype.destroy = function () {
this.dropdown &&
(this.dropdown.parentNode.removeChild(this.dropdown),
(this.el.style.display = ""));
}),
(u.prototype.bindEvent = function () {
this.dropdown.addEventListener("click", this._onClicked.bind(this)),
this.dropdown.addEventListener(
"keydown",
this._onKeyPressed.bind(this)
),
this.dropdown.addEventListener("focusin", o.bind(this, this.el)),
this.dropdown.addEventListener("focusout", n.bind(this, this.el)),
this.el.addEventListener("invalid", l.bind(this, this.el, "invalid")),
window.addEventListener("click", this._onClickedOutside.bind(this)),
this.config.searchable && this._bindSearchEvent();
}),
(u.prototype._bindSearchEvent = function () {
var e = this.dropdown.querySelector(".nice-select-search");
e &&
e.addEventListener("click", function (e) {
return e.stopPropagation(), !1;
}),
e.addEventListener("input", this._onSearchChanged.bind(this));
}),
(u.prototype._onClicked = function (e) {
var t, i;
if (
(e.preventDefault(),
a(this.dropdown, "open")
? this.multiple || (h(this.dropdown, "open"), d(this.el))
: (c(this.dropdown, "open"),
(t = this.el),
(i = document.createEvent("UIEvent")).initEvent(
"modalopen",
!0,
!1
),
t.dispatchEvent(i)),
a(this.dropdown, "open"))
) {
var s = this.dropdown.querySelector(".nice-select-search");
s && ((s.value = ""), s.focus());
var o = this.dropdown.querySelector(".focus");
h(o, "focus"),
c((o = this.dropdown.querySelector(".selected")), "focus"),
this.dropdown.querySelectorAll("ul li").forEach(function (e) {
e.style.display = "";
});
} else this.dropdown.focus();
}),
(u.prototype._onItemClicked = function (e, t) {
var i = t.target;
a(i, "disabled") ||
(this.multiple
? a(i, "selected")
? (h(i, "selected"),
this.selectedOptions.splice(this.selectedOptions.indexOf(e), 1),
this.el
.querySelector(`option[value="${i.dataset.value}"]`)
.removeAttribute("selected"))
: (c(i, "selected"), this.selectedOptions.push(e))
: (this.selectedOptions.forEach(function (e) {
h(e.element, "selected");
}),
c(i, "selected"),
(this.selectedOptions = [e])),
this._renderSelectedItems(),
this.updateSelectValue());
}),
(u.prototype.updateSelectValue = function () {
if (this.multiple) {
var e = this.el;
this.selectedOptions.forEach(function (t) {
var i = e.querySelector(`option[value="${t.data.value}"]`);
i && i.setAttribute("selected", !0);
});
} else
this.selectedOptions.length > 0 &&
(this.el.value = this.selectedOptions[0].data.value);
s(this.el);
}),
(u.prototype.resetSelectValue = function () {
if (this.multiple) {
var e = this.el;
this.selectedOptions.forEach(function (t) {
var i = e.querySelector(`option[value="${t.data.value}"]`);
i && i.removeAttribute("selected");
});
} else this.selectedOptions.length > 0 && (this.el.selectedIndex = -1);
s(this.el);
}),
(u.prototype._onClickedOutside = function (e) {
this.dropdown.contains(e.target) ||
(h(this.dropdown, "open"), d(this.el));
}),
(u.prototype._onKeyPressed = function (e) {
var t = this.dropdown.querySelector(".focus"),
s = a(this.dropdown, "open");
if (13 == e.keyCode) i(s ? t : this.dropdown);
else if (40 == e.keyCode) {
if (s) {
var o = this._findNext(t);
o &&
(h(this.dropdown.querySelector(".focus"), "focus"),
c(o, "focus"));
} else i(this.dropdown);
e.preventDefault();
} else if (38 == e.keyCode) {
if (s) {
var n = this._findPrev(t);
n &&
(h(this.dropdown.querySelector(".focus"), "focus"),
c(n, "focus"));
} else i(this.dropdown);
e.preventDefault();
} else if (27 == e.keyCode && s) i(this.dropdown);
else if (32 === e.keyCode && s) return !1;
return !1;
}),
(u.prototype._findNext = function (e) {
for (
e = e
? e.nextElementSibling
: this.dropdown.querySelector(".list .option");
e;
) {
if (!a(e, "disabled") && "none" != e.style.display) return e;
e = e.nextElementSibling;
}
return null;
}),
(u.prototype._findPrev = function (e) {
for (
e = e
? e.previousElementSibling
: this.dropdown.querySelector(".list .option:last-child");
e;
) {
if (!a(e, "disabled") && "none" != e.style.display) return e;
e = e.previousElementSibling;
}
return null;
}),
(u.prototype._onSearchChanged = function (e) {
var t = a(this.dropdown, "open"),
i = e.target.value;
if ("" == (i = i.toLowerCase()))
this.options.forEach(function (e) {
e.element.style.display = "";
});
else if (t) {
var s = new RegExp(i);
this.options.forEach(function (e) {
var t = e.data.text.toLowerCase(),
i = s.test(t);
e.element.style.display = i ? "" : "none";
});
}
this.dropdown.querySelectorAll(".focus").forEach(function (e) {
h(e, "focus");
}),
c(this._findNext(null), "focus");
}),
t
);
})()
);

View File

@@ -0,0 +1,31 @@
const nice_checkbox = () => {
const allChecboxItems = document.querySelectorAll(".checkbox-item");
if (allChecboxItems?.length) {
allChecboxItems.forEach((checkboxItem, idx) => {
const checkbox = checkboxItem.querySelector("input[type='checkbox']");
if (checkbox) {
const checkmark = checkbox
.closest(".checkbox-item")
.querySelector(".checkmark");
if (checkbox.checked) {
checkmark.classList.add("active");
} else {
checkmark.classList.remove("active");
}
checkbox.addEventListener("change", function () {
const value = this.checked;
const checkmark =
this.closest(".checkbox-item").querySelector(".checkmark");
if (value) {
checkmark.classList.add("active");
} else {
checkmark.classList.remove("active");
}
});
}
});
}
};

View File

@@ -0,0 +1,19 @@
const scrollUp = () => {
const scrollUpElement = document.querySelector(".scroll-up");
if (scrollUpElement) {
scrollUpElement.addEventListener("click", () => {
window.scroll({ top: 0, left: 0, behavior: "smooth" });
});
window.addEventListener("scroll", () => {
const scrollCount = window.scrollY;
if (scrollCount < 300) {
scrollUpElement.classList.remove("active");
}
if (scrollCount > 300) {
scrollUpElement.classList.add("active");
}
});
}
};

View File

@@ -0,0 +1,11 @@
const search = () => {
const searchForm = document.querySelector(".search-form-container");
const searchToggle = document.querySelector(".search-toggle");
const searchShow = document.querySelector(".for-search-show");
const searchClose = document.querySelector(".for-search-close");
if (searchForm) {
searchToggle.addEventListener("click", () => {
searchForm.classList.toggle("active");
});
}
};

View File

@@ -0,0 +1,19 @@
const service = () => {
const serviceCards = document.querySelectorAll(".service-cards");
if (serviceCards?.length) {
serviceCards.forEach((serviceCardsSingle) => {
const allServiceCards =
serviceCardsSingle.querySelectorAll(".service-card");
allServiceCards.forEach((serviceCard, idx) => {
serviceCard.addEventListener("mouseenter", function () {
allServiceCards.forEach((serviceCard) => {
serviceCard.classList.remove("active");
});
this.classList.add("active");
});
});
});
}
};

431
quarter/assets/js/silder.js Normal file
View File

@@ -0,0 +1,431 @@
const silder = () => {
const swiperElement = document.querySelector(".swiper");
if (swiperElement) {
// swiper slider
var swiper = new Swiper(".primary-slider", {
slidesPerView: 1,
effect: "fade",
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
// hero2 slider
var swiperThumbs = new Swiper(".hero-slider2-tumbs_slider", {
loop: true,
spaceBetween: 10,
slidesPerView: 3,
speed: 800,
// freeMode: true,
watchSlidesProgress: true,
breakpoints: {
1600: {
spaceBetween: 20,
},
},
});
var swiper1 = new Swiper(".hero-slider2", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
thumbs: {
swiper: swiperThumbs,
},
});
// featured apartments slider
var swiper = new Swiper(".featured-apartments-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
1200: {
slidesPerView: 3,
},
1800: {
slidesPerView: 4,
},
},
});
// featured apartments slider2
var swiper = new Swiper(".featured-apartments-slider2", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
992: {
slidesPerView: 3,
},
},
});
// testimonials slider
var swiper = new Swiper(".testimonials-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
992: {
slidesPerView: 3,
},
},
});
// testimonials2 slider
var swiper = new Swiper(".testimonials-slider2", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
768: {
slidesPerView: 2,
},
},
});
// testimonials 3 slider
const testimonials3ThumbsSlider = new Swiper(
".testimonials3-tumbs_slider",
{
slidesPerView: "auto",
cssMode: true,
preventClicks: false,
}
);
const testimonialsSlider3 = new Swiper(".testimonials-slider-3", {
slidesPerView: 1,
loop: true,
speed: 1500,
effect: "fade",
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
thumbs: {
swiper: testimonials3ThumbsSlider,
},
});
// testimonials 4 slider
var testimonialsSlider4 = new Swiper(".testimonials-slider-4", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
1200: {
slidesPerView: 3,
},
},
});
const testimonialQuoteMenus = document.querySelectorAll(
".testimonial-quote-menu"
);
// random thumb menu
if (testimonialQuoteMenus?.length) {
testimonialQuoteMenus.forEach((quoteMenu, idx) => {
const menuContainer = quoteMenu.closest(
".testimonial-quote-menu-container"
);
const quoteMenu2 = quoteMenu;
let innerHtmlogQuoteMenu2 = "";
let ul = document.createElement("ul");
ul.classList.add("testimonial-quote-menu", "testimonial-quote-menu2");
quoteMenu2.querySelectorAll("li").forEach((li2) => {
innerHtmlogQuoteMenu2 += `<li>${li2.innerHTML}</li>`;
});
ul.innerHTML = innerHtmlogQuoteMenu2;
if (menuContainer) {
menuContainer.appendChild(ul);
}
});
const menuCopy = document.querySelector(".testimonial-quote-menu2");
// add active class to animatable image
const isActive = (cs) => {
menuCopy.style.zIndex = 20;
menuCopy.querySelectorAll("li").forEach((li, idx) => {
li.classList.remove("active");
if (cs === idx) {
li.classList.add("active");
}
setTimeout(() => {
li.classList.remove("active");
menuCopy.style.zIndex = 1;
}, 300);
});
};
testimonialsSlider3.eventsListeners.activeIndexChange[0] = (e) => {
if (
testimonialsSlider3.realIndex !==
testimonialsSlider3.previousRealIndex
) {
isActive(testimonialsSlider3.realIndex);
}
};
}
// news slider
var swiper = new Swiper(".news-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
1200: {
slidesPerView: 3,
},
},
});
// news single slider
var swiper = new Swiper(".news-single-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
// properties slider
var swiper = new Swiper(".properties-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
992: {
slidesPerView: 3,
},
},
});
// upcoming projects slider
var swiper = new Swiper(".project-slider-container", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
// neighbour slider
var neighbourswiperThumbs = new Swiper(".neighbour-slider-tumbs_slider", {
loop: true,
spaceBetween: 8,
slidesPerView: 3,
freeMode: true,
watchSlidesProgress: true,
});
var swiper = new Swiper(".neighbour-slider", {
slidesPerView: 1,
speed: 800,
effect: "fade",
thumbs: {
swiper: neighbourswiperThumbs,
},
});
// brands slider
var swiper = new Swiper(".brand-slider", {
slidesPerView: 2,
spaceBetween: 30,
speed: 800,
loop: true,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
breakpoints: {
576: {
slidesPerView: 3,
},
768: {
slidesPerView: 4,
},
992: {
slidesPerView: 5,
},
},
});
// portfolio slider
var swiper = new Swiper(".portfolio-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
576: {
slidesPerView: 2,
},
992: {
slidesPerView: 3,
},
1200: {
slidesPerView: 4,
},
},
});
// popular properties slider
var swiper = new Swiper(".popular-properties-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
autoplay: {
delay: 5000,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
// product details slider
var swiper = new Swiper(".product-details-slider", {
slidesPerView: 1,
loop: true,
speed: 800,
preventClicksPropagation: false,
centeredSlides: true,
autoplay: {
delay: 10000,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
768: {
slidesPerView: 1.6,
},
992: {
slidesPerView: 1.55,
},
1600: {
slidesPerView: 1.9,
},
},
});
}
};

View File

@@ -0,0 +1,20 @@
const smoothScroll = () => {
var links = document.querySelectorAll('a[href^="#"]');
if (!links.length) {
return;
}
links.forEach(function (link) {
link.addEventListener("click", function (e) {
e.preventDefault();
var targetId = this.getAttribute("href").substring(1);
var targetElement = document.getElementById(targetId);
if (targetElement) {
targetElement.scrollIntoView({ behavior: "smooth" });
} else {
window.scroll({ top: 0, left: 0, behavior: "smooth" });
}
});
});
};

View File

@@ -0,0 +1,35 @@
const stickystickyHeader = () => {
const header = document.querySelector("header");
const stickyHeader = header?.querySelector(".sticky-header");
if (stickyHeader) {
window.addEventListener("scroll", () => {
const stickyHeaderHeight = stickyHeader.offsetHeight;
const scrollCount = window.scrollY;
// if (scrollCount - headerHeight < 0 && scrollCount - headerHeight > -5) {
// }
if (scrollCount < 300) {
if (scrollCount > 200) {
stickyHeader.setAttribute(
"style",
`position: fixed;top: -${stickyHeaderHeight}px;left:0;right:0
`
);
stickyHeader.classList.remove("active");
} else {
stickyHeader.removeAttribute("style");
stickyHeader.classList.remove("active");
}
}
if (scrollCount > 300) {
stickyHeader.setAttribute(
"style",
" position: fixed;top: 0px; left:0;right:0 "
);
stickyHeader.classList.add("active");
}
});
}
};

7503
quarter/assets/js/swiper-bundle.min.js vendored Normal file

File diff suppressed because it is too large Load Diff

97
quarter/assets/js/tabs.js Normal file
View File

@@ -0,0 +1,97 @@
// handle current tablink style
const handleCurrentTabLinkStyle = (tabLinks, currentIndex) => {
tabLinks.forEach((tabLink, idx) => {
const currentTabLink = tabLinks[currentIndex];
const tabLinkClasses = tabLink.classList;
const currentTabLinkClasses = currentTabLink.classList;
const spanClasses = tabLink.querySelector("span")?.classList;
const currentSpanClasses = currentTabLink.querySelector("span")?.classList;
if (spanClasses) {
// button default style
tabLinkClasses.remove("bg-white", "shadow-bottom", "active");
tabLinkClasses.add(
"bg-lightGrey7",
"dark:bg-lightGrey7-dark",
"inActive"
);
spanClasses.replace("w-full", "w-0");
tabLink.disabled = false;
// current button style
if (currentIndex === idx) {
currentTabLink.disabled = true;
currentTabLinkClasses.remove(
"bg-lightGrey7",
"dark:bg-lightGrey7-dark",
"inActive"
);
currentTabLinkClasses.add(
"bg-white",
"dark:bg-whiteColor-dark",
"shadow-bottom",
"active"
);
currentSpanClasses.replace("w-0", "w-full");
}
} else {
tabLinkClasses.remove("before:w-full", "active");
if (currentIndex === idx) {
tabLinkClasses.add("before:w-full", "active");
}
}
});
};
// handle tab content
const handleTabContents = (tab, currentIndex) => {
const nodeListOftabContents = tab.querySelector(".tab-contents").children;
const tabContents = [...nodeListOftabContents];
const currentTabContentClasses = tabContents[currentIndex].classList;
tabContents.forEach((tabContent, idx) => {
const tabContentClasses = tabContent.classList;
// tab contents default style
tabContentClasses.remove("block");
tabContentClasses.add("hidden");
if (currentIndex === idx) {
currentTabContentClasses.add("block", "opacity-0");
currentTabContentClasses.remove("hidden", "opacity-100");
// add accordion style
const accordion = tab.querySelector(".accordion.active");
if (accordion) {
const contents = accordion.querySelector(".accordion-content");
const contentHeight = contents.children[idx]?.offsetHeight;
if (contentHeight) {
contents.style.height = `${contentHeight}px`;
}
}
setTimeout(() => {
currentTabContentClasses.remove("opacity-0");
currentTabContentClasses.add("opacity-100");
}, 150);
}
});
};
// get tab links and listen link events
const handleTabLinks = (tab) => {
const nodeListOfTabLinks = tab.querySelector(".tab-links").children;
const tabLinks = [...nodeListOfTabLinks];
tabLinks.forEach((tabLink, idx) => {
tabLink.addEventListener("click", () => {
handleCurrentTabLinkStyle(tabLinks, idx);
handleTabContents(tab, idx);
});
});
};
// main tab controller
const tabsController = () => {
const nodeListOfTabs = document.querySelectorAll(".tab");
const tabs = [...nodeListOfTabs];
tabs.forEach((tab) => handleTabLinks(tab));
};

File diff suppressed because it is too large Load Diff