File: /home/dkhp464/public_html/wp-content/themes/DaKhoaHongPhat/assets/js/scrip.js
$('.slide-banner').owlCarousel({
loop: true,
margin: 10,
items: 1,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 4000,
autoplaySpeed: 1500,
dotsSpeed: 1500,
})
$('.slide-banner-mb').owlCarousel({
loop: true,
margin: 10,
items: 1,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 4000,
autoplaySpeed: 1500,
dotsSpeed: 1500,
})
$('.slide-choose').owlCarousel({
loop: true,
margin: 10,
nav: true,
dots: true,
responsiveClass: true,
autoplay: true,
autoplayTimeout: 3000,
autoplaySpeed: 1500,
dotsSpeed: 1500,
responsive: {
0: {
items: 1,
nav: false
},
900: {
items: 2,
nav: false
},
1000: {
items: 3
}
}
})
// ==============================
$(document).ready(function () {
$(".navbar-main .menu-item-has-children > a").after('<i class="bi fa-solid fa-angle-right" style="color: #111212;"></i>');
$(".menu-mb .menu-item-has-children > a").after('<i class="bi fa-solid fa-angle-right toggle-icon"></i>');
// $(".navbar-sidebar .menu-item-has-children > a").after('<i class="bi fa-solid fa-angle-right"></i>');
});
$(document).ready(function () {
$('.navbar-main .menu-item-has-children > .bi').click(function () {
$(this).siblings('.sub-menu').slideToggle();
});
// $('.navbar-sidebar').on('click', '.menu-item-has-children > i', function () {
// $(this).parent("li").toggleClass("active");
// $(this).siblings('.sub-menu').slideToggle();
//Đóng mở menu sidebar
$(".toggle-icon").click(function () {
var submenu = $(this).siblings(".sub-menu");
submenu.slideToggle();
});
});
var openMenu = null; // Biến để lưu trạng thái menu đang mở
$('.navbar-sidebar').on('click', '.menu-item-has-children > i', function () {
var currentMenu = $(this).parent("li");
if (currentMenu.hasClass("active")) {
// Đóng menu hiện tại nếu nó đang mở
currentMenu.removeClass("active");
currentMenu.find('.sub-menu').slideUp();
openMenu = null;
} else {
// Kiểm tra nếu có menu khác đang mở, thì đóng menu đang mở
if (openMenu !== null) {
openMenu.removeClass("active");
openMenu.find('.sub-menu').slideUp();
}
// Mở menu hiện tại
currentMenu.addClass("active");
currentMenu.find('.sub-menu').slideDown();
openMenu = currentMenu;
}
});
// ===========LOADING===================
jQuery((function ($) {
$(".d_contact_new").submit((function (e) {
thisForm = $(this), e.preventDefault();
var serialize = $(this).serialize();
$.ajax({
url: admin_ajax_url,
type: "POST",
data: {
action: "submit_form",
data: serialize
},
beforeSend: function () {
$(".loading").addClass("show")
},
success: function (res) {
if (res = JSON.parse(res), $(".loading").removeClass("show"), res.result) thisForm.trigger("reset"), alert("Gửi thành công, chúng tôi sẽ liên hệ lại với bạn sớm nhất."), setTimeout((function () {
window.location.href = live_chat_redirect
}), 2e3);
else {
let error = "Có lỗi xảy ra: \n";
for (const property in res.data) error += `${res.data[property]}\n`;
alert(error)
}
},
error: function (jqXHR, textStatus, errorThrown) {
$(".loading").removeClass("show"), console.log(textStatus, errorThrown), alert("Đã có lỗi xảy ra.")
}
})
}))
}))
jQuery((function ($) {
$(".search-leave").submit((function (e) {
thisForm = $(this), e.preventDefault();
var serialize = $(this).serialize();
$.ajax({
url: admin_ajax_url,
type: "POST",
data: {
action: "submit_form",
data: serialize
},
beforeSend: function () {
$(".loading").addClass("show")
},
success: function (res) {
if (res = JSON.parse(res), $(".loading").removeClass("show"), res.result) thisForm.trigger("reset"), alert("Gửi thành công, chúng tôi sẽ liên hệ lại với bạn sớm nhất."), setTimeout((function () {
window.location.href = live_chat_redirect
}), 2e3);
else {
let error = "Có lỗi xảy ra: \n";
for (const property in res.data) error += `${res.data[property]}\n`;
alert(error)
}
},
error: function (jqXHR, textStatus, errorThrown) {
$(".loading").removeClass("show"), console.log(textStatus, errorThrown), alert("Đã có lỗi xảy ra.")
}
})
}))
}))
var today = new Date().toISOString().split('T')[0];
var inputElements = document.querySelectorAll("#input-day-contact, #input-date-time");
inputElements.forEach(function (element) {
element.setAttribute('min', today);
})
// ==========================================================
var today = new Date().toISOString().split('T')[0];
var inputElements = document.querySelectorAll("#input-day-contact, #input-date-time");
inputElements.forEach(function (element) {
element.setAttribute('min', today);
})
// =====================================================
// ===================================
// ======================Pop-Up========================
function hien() {
$(".popupcss").css({ "display": "block" });
}
function tatpopup() {
$(".popupcss").css({ "display": "none" });
}
$('.counter').each(function () {
var $this = $(this),
countTo = $this.attr('data-count');
$({
countNum: $this.text()
}).animate({
countNum: countTo
}, {
duration: 50000,
easing: 'linear',
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
}
});
});
// ====================Check-Box======================
const checkboxes = document.querySelectorAll('.checkbox-sig-up');
checkboxes.forEach(function (checkbox) {
checkbox.addEventListener('change', function () {
checkboxes.forEach(function (otherCheckbox) {
if (otherCheckbox !== checkbox) {
otherCheckbox.checked = false;
}
});
});
});
// ===============CLone-Menu-Sidebar================
$(document).ready(function () {
var menuItems = $('.menu > li > ul ').clone();
menuItems.appendTo('.navbar-sidebar');
// $('.navbar-sidebar ul li a ').prepend('<i class="fa-solid fa-angles-right"></i>');
})
// ====================Close-PopUp======================
document.addEventListener('DOMContentLoaded', function () {
// var popup = document.getElementById('popup-mid');
// var closeBtn = document.querySelector('.closepp');
// function showPopup() {
// popup.style.display = 'block';
// }
// function hidePopup() {
// popup.style.display = 'none';
// }
// closeBtn.addEventListener('click', function() {
// hidePopup();
// });
// setInterval(function() {
// showPopup();
// // setTimeout(hidePopup, 15000);
// }, 60000);
});
// ================================================