(function ($) { "use strict"; new WOW().init(); /*---background image---*/ function dataBackgroundImage() { $('[data-bgimg]').each(function () { var bgImgUrl = $(this).data('bgimg'); $(this).css({ 'background-image': 'url(' + bgImgUrl + ')', // + meaning concat }); }); } $(window).on('load', function () { dataBackgroundImage(); }); $("#li-slider-active").owlCarousel({ loop: true, margin: 0, nav: false, navText: ['',''], autoplay: true, items: 1, autoplayTimeout: 3000, // navText: false, dots: false, autoHeight: true, lazyLoad: true }); $("#li-slider-fullpage-active").owlCarousel({ items: 1, loop: true, autoplay: true, dots: true, nav: false, smartSpeed: 2000, // Tốc độ chuyển animateOut: 'fadeOut', // Hiệu ứng ra animateIn: 'fadeIn', // Hiệu ứng vào onInitialized: addFullpageDotNumbers, onChanged: addFullpageDotNumbers, responsive: { 0: { items: 1 }, 768: { items: 1 }, 1024: { items: 1 } } }); function addFullpageDotNumbers() { $('.owl-dot').each(function(index){ $(this).html(index + 1); }); } /*---stickey menu---*/ // $(window).on('scroll',function() { // var scroll = $(window).scrollTop(); // if (scroll < 100) { // $(".sticky-header").removeClass("sticky"); // }else{ // $(".sticky-header").addClass("sticky"); // } // }); $("#li-productdocpage-slider-active").owlCarousel({ items: 1, loop: true, autoplay: true, dots: true, nav: true, navText: [ '', '' ], smartSpeed: 2000, // Tốc độ chuyển animateOut: 'fadeOut', // Hiệu ứng ra animateIn: 'fadeIn', // Hiệu ứng vào onInitialized: addProductdocpageSliderDotNumbers, onChanged: addProductdocpageSliderDotNumbers, responsive: { 0: { items: 1 }, 768: { items: 1 }, 1024: { items: 1 } } }); function addProductdocpageSliderDotNumbers() { $('.owl-dot').each(function(index){ $(this).html('' + (index + 1) + ''); }); } /*---partner activation---*/ $("#li-partner-active").owlCarousel({ loop: true, nav: true, autoplay: true, autoplayTimeout: 8000, items: 5, dots:false, margin: 30, navText: [ '', '' ], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:5, }, 992:{ items:5, }, 1200:{ items:5, }, } }); /*---galleryboard activation---*/ $("#li-galleryboard-active").owlCarousel({ loop: true, nav: true, autoplay: true, autoplayTimeout: 8000, items: 1, dots:true, margin: 30, onInitialized: addFullpageDotNumbers, onChanged: addFullpageDotNumbers, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:1, }, 992:{ items:1, }, 1200:{ items:1, }, } }); /*---galleryboard_lh activation---*/ $("#li-galleryboard_lh-active").owlCarousel({ loop: true, nav: true, autoplay: true, autoplayTimeout: 8000, items: 4, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:4, }, } }); /*---videoboard_lh activation---*/ $("#li-videoboard_lh-active").owlCarousel({ loop: true, nav: true, autoplay: true, autoplayTimeout: 8000, items: 4, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:4, }, } }); /*---newsdoc activation---*/ $("#li-newsdoc-active").owlCarousel({ loop: true, nav: false, autoplay: true, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:3, }, } }); /*---salesdoc activation---*/ $("#li-salesdoc-active").owlCarousel({ loop: true, nav: true, autoplay: true, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:2, }, 1200:{ items:3, }, } }); /*---ultilitiesdoc activation---*/ $("#li-ultilitiesdoc-active").owlCarousel({ loop: true, nav: false, autoplay: true, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:3, }, } }); /*---envirinfosdoc activation---*/ $("#li-envirinfosdoc-active").owlCarousel({ loop: true, nav: false, autoplay: true, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:3, }, } }); /*---waterpricesdoc activation---*/ $("#li-waterpricesdoc-active").owlCarousel({ loop: true, nav: false, autoplay: true, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:3, }, } }); /*---investors activation---*/ $("#li-investors-active").owlCarousel({ loop: true, nav: false, autoplay: true, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:3, }, } }); /*---single galleryboard activation---*/ $("#li-singlegalleryboard-carousel").owlCarousel({ items: 1, loop: true, nav: false, dots: false, dotsData: true, autoplay: true, autoplayTimeout: 5000, navText: [ '', '' ] }); $('#li-singlegalleryboard-dots .owl-custom-dot').each(function(index) { $(this).off('click').on('click', function () { $("#li-singlegalleryboard-carousel").trigger('to.owl.carousel', [index, 300]); }); }); $("#li-singlegalleryboard-carousel").on('changed.owl.carousel', function(event) { const index = event.item.index - event.relatedTarget._clones.length / 2; const count = event.item.count; const realIndex = ((index % count) + count) % count; $('#li-singlegalleryboard-dots .owl-custom-dot').removeClass('active'); $('#li-singlegalleryboard-dots .owl-custom-dot').eq(realIndex).addClass('active'); }); /*---small product activation---*/ $('.paralax-hor').slick({ slidesToShow: 2, arrows:false, draggable: true, infinite: false, responsive:[ { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } }, { breakpoint: 1200, settings: { slidesToShow: 2, slidesToScroll: 1, rows: 1, } }, ] }); let viewedIndexes = new Set(); $('.slick-slider').on('afterChange', function(event, slick, currentSlide) { const slidesToShow = slick.options.slidesToShow; for (let i = currentSlide; i < currentSlide + slidesToShow; i++) { viewedIndexes.add(i); } console.log('Đã xem các item:', Array.from(viewedIndexes)); if (viewedIndexes.size >= 3) { console.log('Người dùng đã xem ít nhất 3 item khác nhau!'); // Tùy ý thực hiện hành động tại đây, ví dụ: hiển thị nút, gửi tracking, v.v. } // Reset nếu quay về slide đầu if (currentSlide === 0) { viewedIndexes.clear(); console.log('Reset danh sách item đã xem.'); } }); /*---slider activation---*/ $('.slider_carousel').owlCarousel({ animateOut: 'fadeOut', loop: true, nav: false, autoplay: false, autoplayTimeout: 8000, items: 1, dots: true, }); /*---categories column7 activation---*/ $('.categories_column7').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: false, autoplay: false, autoplayTimeout: 8000, items: 7, margin: 20, dots:false, responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 576:{ items:3, }, 768:{ items:5, }, 992:{ items:5, }, 1200:{ items:6, }, 1300:{ items:7, }, } }); /*---product column6 activation---*/ $('.product_column6').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 6, margin: 20, dots:false, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 576:{ items:2, }, 768:{ items:3, }, 992:{ items:4, }, 1200:{ items:5, }, 1301:{ items:6, }, } }); /*---product column5 activation---*/ $('.product_column5').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: false, autoplay: false, autoplayTimeout: 8000, items: 5, dots:false, margin: 30, responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 768:{ items:3, }, 992:{ items:4, }, 1200:{ items:5, }, } }); function checkClasses(){ var total = $('.product_column5 .owl-stage .owl-item.active').length; $(".product_column5").each(function(){ $(this).find('.owl-item').removeClass('firstActiveItem'); $(this).find('.owl-item').removeClass('lastActiveItem'); $(this).find('.owl-item.active').each(function(index){ if (index === 0) { $(this).addClass('firstActiveItem'); } if (index === total - 1 && total > 1) { $(this).addClass('lastActiveItem'); } }); }); } checkClasses(); /*---product details column5 activation---*/ $('.product_details_column5').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 5, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 768:{ items:3, }, 992:{ items:4, }, 1200:{ items:5, }, } }); /*---product column4 activation---*/ $('.product_column4').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 4, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 768:{ items:3, }, 992:{ items:3, }, 1200:{ items:4, }, } }); /*---product column3 activation---*/ $('.product_column3').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 3, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 480:{ items:2, }, 768:{ items:3, }, 992:{ items:2, }, 1200:{ items:2, }, 1300:{ items:3, }, } }); /*---product column2 activation---*/ $('.product_column2').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 2, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:1, }, 992:{ items:2, }, } }); /*---product column2 activation---*/ $('.product_style_four').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 2, margin: 20, dots:false, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:1, }, 1200:{ items:2, }, } }); /*---product column1 activation---*/ $('.product_column1').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 1, dots:false, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, margin: 20, }, 992:{ items:1, }, } }); /*---deals product column1 activation---*/ $('.deals_product_column1').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 1, dots:false, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 992:{ items:1, }, } }); /*---small product activation---*/ $('.small_product_active').slick({ centerMode: true, centerPadding: '0', slidesToShow: 1, arrows:true, rows: 4, prevArrow:'', nextArrow:'', responsive:[ { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } }, { breakpoint: 1200, settings: { slidesToShow: 1, slidesToScroll: 1, rows: 3, } }, ] }); /*---testimonial active activation---*/ $('.testimonial-two').owlCarousel({ loop: true, nav: false, autoplay: true, autoplayTimeout: 8000, items: 3, dots: false, responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:3, }, } }) /*---blog column3 activation---*/ $('.blog_column4').owlCarousel({ loop: true, nav: false, autoplay: false, autoplayTimeout: 8000, items: 4, dots:false, margin: 30, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 768:{ items:2, }, 992:{ items:3, }, 1200:{ items:4, }, } }); /*---brand container activation---*/ $('.brand_container').on('changed.owl.carousel initialized.owl.carousel', function (event) { $(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({ loop: true, nav: false, autoplay: false, autoplayTimeout: 8000, items: 6, dots:false, responsiveClass:true, responsive:{ 0:{ items:1, }, 320:{ items:2, }, 576:{ items:3, }, 768:{ items:4, }, 992:{ items:5, }, 1200:{ items:6, }, } }); function checkClasses(){ var total = $('.brand_container .owl-stage .owl-item.active').length; $(".brand_container").each(function(){ $(this).find('.owl-item').removeClass('firstActiveItem'); $(this).find('.owl-item').removeClass('lastActiveItem'); $(this).find('.owl-item.active').each(function(index){ if (index === 0) { $(this).addClass('firstActiveItem'); } if (index === total - 1 && total > 1) { $(this).addClass('lastActiveItem'); } }); }); } checkClasses(); /*---blog thumb activation---*/ $('.blog_thumb_active').owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 1, navText: ['',''], }); /*---single product activation---*/ $('.single-product-active').owlCarousel({ loop: true, nav: true, autoplay: false, autoplayTimeout: 8000, items: 4, margin:15, dots:false, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 320:{ items:2, margin:10, }, 992:{ items:3, }, 1200:{ items:4, }, } }); /*---product navactive activation---*/ $('.product_navactive').owlCarousel({ loop: false, nav: true, autoplay: false, items: 4, dots:false, navText: ['',''], responsiveClass:true, responsive:{ 0:{ items:1, }, 250:{ items:2, }, 480:{ items:3, }, 768:{ items:4, }, } }); $('.modal').on('shown.bs.modal', function (e) { $('.product_navactive').resize(); }) $('.product_navactive a').on('click',function(e){ e.preventDefault(); var $href = $(this).attr('href'); $('.product_navactive a').removeClass('active'); $(this).addClass('active'); $('.product-details-large .tab-pane').removeClass('active show'); $('.product-details-large '+ $href ).addClass('active show'); }) /*--- video Popup---*/ $('.video_popup').magnificPopup({ type: 'iframe', removalDelay: 300, mainClass: 'mfp-fade' }); /* Popup Video */ if ($('.popup-video').length) { $('.popup-video').magnificPopup({ type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: true }); } /*--- Magnific Popup Video---*/ $('.port_popup').magnificPopup({ type: 'image', gallery: { enabled: true } }); $('#nav-tab a,#nav-tab2 a').on('click', function (e) { e.preventDefault() $(this).tab('show') }) /*--- niceSelect---*/ $('.select_option').niceSelect(); /*--- Accordion---*/ $(".faequently-accordion").collapse({ accordion:true, open: function() { this.slideDown(300); }, close: function() { this.slideUp(300); } }); /*--- counterup activation ---*/ $('.counter_number').counterUp({ delay: 10, time: 1000 }); /*--- ScrollUp Active ---*/ $.scrollUp({ scrollText: '', easingType: 'linear', scrollSpeed: 900, animation: 'fade' }); /*---countdown activation---*/ $('[data-countdown]').each(function() { var $this = $(this), finalDate = $(this).data('countdown'); $this.countdown(finalDate, function(event) { $this.html(event.strftime('