webiste mau thoi trang 2

This commit is contained in:
2023-04-13 10:48:43 +07:00
parent e0e22cfe44
commit b6a590e795
37 changed files with 4280 additions and 0 deletions

View File

@@ -0,0 +1,162 @@
$(document).ready(function () {
$(".content-footer-main .item .title").click(function () {
$(this).parents(".show-footer").toggleClass("active");
});
})
$(document).ready(function () {
var sync1 = $("#sync1");
var sync2 = $("#sync2");
var slidesPerPage = 7; //globaly define number of elements per page
var syncedSecondary = true;
sync1.owlCarousel({
items: 2,
slideSpeed: 2000,
nav: true,
center: false,
autoplay: false,
autoplayTimeout: 2000,
autoplaySpeed: 1000,
autoplayHoverPause: true,
dots: false,
loop: false,
lazyLoad: true,
responsiveRefreshRate: 200,
margin: 20,
navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
}).on('changed.owl.carousel', syncPosition);
sync2
.on('initialized.owl.carousel', function () {
sync2.find(".owl-item").eq(0).addClass("current");
})
.owlCarousel({
items: slidesPerPage,
margin: 15,
loop: false,
dots: false,
nav: false,
navText: ['<span class="fa fa-chevron-left"></span>', '<span class="fa fa-chevron-right"></span>'],
slideBy: slidesPerPage, //alternatively you can slide by 1, this way the active slide will stick to the first item in the second carousel
responsiveRefreshRate: 100
}).on('changed.owl.carousel', syncPosition2);
function syncPosition(el) {
//if you set loop to false, you have to restore this next line
//var current = el.item.index;
//if you disable loop you have to comment this block
var count = el.item.count - 1;
var current = Math.round(el.item.index - (el.item.count / 2) - .5);
if (current < 0 && 1 < 2) {
current = count;
}
if (current > count) {
current = 0;
}
//end block
sync2
.find(".owl-item")
.removeClass("current")
.eq(current)
.addClass("current");
var onscreen = sync2.find('.owl-item.active').length - 1;
var start = sync2.find('.owl-item.active').first().index();
var end = sync2.find('.owl-item.active').last().index();
if (current > end) {
sync2.data('owl.carousel').to(current, 100, true);
}
if (current < start && 1 < 2) {
sync2.data('owl.carousel').to(current - onscreen, 100, true);
}
}
function syncPosition2(el) {
if (syncedSecondary) {
var number = el.item.index;
sync1.data('owl.carousel').to(number, 100, true);
}
}
sync2.on("click", ".owl-item", function (e) {
e.preventDefault();
var number = $(this).index();
sync1.data('owl.carousel').to(number, 300, true);
});
$("#title_tab_scroll_pro a").click(function () {
$("#title_tab_scroll_pro a").removeClass("active");
$(this).addClass("active");
var idTab = $(this).attr('href');
$('.content-tab').removeClass('active');
$(idTab).addClass('active')
return false;
});
});
const MIN_PAGE_PRICE = parseInt('0');
const MAX_PAGE_PRICE = parseInt('1000000');
var current_min = parseInt('0');
var current_max = parseInt('1000000');
$(document).ready(function () {
$('.max-price-filter').html(formatCurrency(current_max) + ' đ');
$('#input-min-price-filter').val(formatCurrency(current_min))
$('#input-max-price-filter').val(formatCurrency(current_max));
$("#slider-range").slider({
range: "max",
max: 0,
min: 0,
max: MAX_PAGE_PRICE,
values: 2,
slide: function (event, ui) {
console.log(ui)
var max = Math.floor(ui.value);
$('.max-price-filter').html(formatCurrency(max) + ' đ');
$('#input-max-price-filter').html(formatCurrency(max));
},
});
$("#slider-range").slider("option", "max", MAX_PAGE_PRICE);
})
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;
}
function finterPriceSli() {
var getMinPriceString = $('#input-min-price-filter').val();
var getMaxPriceString = $('#input-max-price-filter').val();
var getMinPrice = parseInt(getMinPriceString.replace(/\./g, ''));
var getMaxPrice = parseInt(getMaxPriceString.replace(/\./g, ''));
var textMinPrice = 'trieu';
var textMaxPrice = 'trieu';
if (getMinPrice < 1000000) {
var minPrice = Math.floor(getMinPrice / 1000);
textMinPrice = 'ngan';
} else {
var minPrice = Math.floor(getMinPrice / 1000000);
}
if (getMaxPrice < 1000000) {
var maxPrice = Math.round(getMaxPrice / 1000);
textMaxPrice = 'ngan';
} else {
var maxPrice = Math.round(getMaxPrice / 1000000);
}
window.location.href = '?p=' + minPrice + textMinPrice + '-' + maxPrice + textMaxPrice;
}