$(document).ready(function () { $('.faqlink').click(function () { $(this).parents('.item').toggleClass('active'); }); }); var swiper_thumb = new Swiper(".thumbImage", { spaceBetween: 10, slidesPerView: 4, direction: "vertical", loop: true, on: { init: (swiper) => { let totalGap = swiper.passedParams.spaceBetween * (swiper.passedParams.slidesPerView - 1); let containerHeight = swiper.passedParams.slidesPerView * swiper.slides[0].clientHeight + totalGap; swiper.el.style.height = containerHeight + 'px'; }, }, }); var swiper_big = new Swiper(".BigImage", { spaceBetween: 10, watchSlidesProgress: true, noSwiping: true, navigation: { nextEl: "#js-image-next", prevEl: "#js-image-prev", }, thumbs: { swiper: swiper_thumb, }, }); const showButton = document.getElementById('click-show'); const priceList = document.getElementById('price-list'); let currentIndex = 4; // Ban đầu hiển thị 4 item showButton.addEventListener('click', () => { const itemWidth = document.querySelector('.item').offsetWidth; priceList.scrollBy({ left: itemWidth, behavior: 'smooth' }); currentIndex++; // Nếu đã scroll qua hết các item thì ẩn nút if (currentIndex >= document.querySelectorAll('.item').length) { showButton.style.display = 'none'; } }); function formatCurrency(a) { var b = parseFloat(a).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1.").toString(); var len = b.length; b = b.substring(0, len - 3); return b; } $('#price-list .item').on('click', function () { var price = $(this).attr('data-price'); $('#js-input-price').val(formatCurrency(price)); }) productDetailTab() function productDetailTab() { $(".tab .item-tab").click(function () { var datatab = $(this).attr("data-id"); $(".tab .item-tab").removeClass("active"); $('.content-tab').removeClass("active"); $(this).addClass("active"); $(datatab).addClass("active"); }); } TabHistory(); function TabHistory() { $(".tab-history .item-tab").click(function () { var datatab = $(this).attr("data-id"); $(".tab-history .item-tab").removeClass("active"); $('.table-tab').removeClass("active"); $(this).addClass("active"); $(datatab).addClass("active"); }); } checkRules(); function checkRules() { $('#submit_rules').on('click', function () { if ($('#check_rules').is(':checked')) { $('.box-popup').removeClass('active'); $('.popup-login').addClass('active') } else { alert('Quý khách cần đồng ý với thể lệ của chương trình') } }) } function closePopop() { $('.box-popup').removeClass('active'); $('.overlay').removeClass('active') } function checkAucton() { $('.overlay').addClass('active') $('.popup-rules').addClass('active') } function checklogin() { $('.box-popup').removeClass('active'); $('.popup-yeucau').addClass('active') } function showInfoPay() { $('.box-popup').removeClass('active'); $('.popup-info-pay').addClass('active') } formatPrice(); function formatPrice() { $('#js-input-price').on('input', function () { let inputValue = $(this).val().replace(/\D/g, ''); let formattedValue = new Intl.NumberFormat().format(inputValue); $(this).val(formattedValue); }); } function checkSendAuction() { $('.box-popup').removeClass('active'); const price_present = _strToNumber($('#js-price-present').html()); const price_auction = _strToNumber($('#js-input-price').val()); const price_min = price_present + 300000; if (price_auction > price_present) { $('.overlay').addClass('active') $('.popup-success').addClass('active') } else { $('.overlay').addClass('active') $('.popup-error').addClass('active') $('#js-price-min').html(formatCurrency(price_min)) } } function _strToNumber(str) { str += ''; while (str.indexOf(".") > 0) { str = str.replace('.', ''); } var result = parseFloat(str); return isNaN(result) ? 0 : result; } function checkOTP() { $('.box-popup').removeClass('active'); $('.overlay').addClass('active') $('.popup-thongbao').addClass('active') } function SendcheckOTP() { $('.box-popup').removeClass('active'); $('.overlay').addClass('active') $('.popup-input-opt').addClass('active') } function closePopop() { $('.box-popup').removeClass('active'); $('.overlay').removeClass('active') } Tab(); function Tab() { $(".tab .item-tab").click(function () { var datatab = $(this).attr("data-id"); $(".tab .item-tab").removeClass("active"); $('.content-tab').removeClass("active"); $(this).addClass("active"); $(datatab).addClass("active"); }); }