/** https://bootstrapmade.com/license/ */ !(function ($) { "use strict"; // smooth scroll for the navigation menu and links with .scrollto classes $(document).on('click', '.nav-menu a, .mobile-nav a, .scrollto', function (e) { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { e.preventdefault(); var target = $(this.hash); if (target.length) { var scrollto = target.offset().top; var scrolled = 20; if ($('#header').length) { scrollto -= $('#header').outerheight() if (!$('#header').hasclass('header-scrolled')) { scrollto += scrolled; } } if ($(this).attr("href") == '#header') { scrollto = 0; } $('html, body').animate({ scrolltop: scrollto }, 1500, 'easeinoutexpo'); if ($(this).parents('.nav-menu, .mobile-nav').length) { $('.nav-menu .active, .mobile-nav .active').removeclass('active'); $(this).closest('li').addclass('active'); } if ($('body').hasclass('mobile-nav-active')) { $('body').removeclass('mobile-nav-active'); $('.mobile-nav-toggle i').toggleclass('bx-menu bx-x'); $('.mobile-nav-overly').fadeout(); } return false; } } }); // mobile navigation if ($('.nav-menu').length) { var $mobile_nav = $('.nav-menu').clone().prop({ class: 'mobile-nav d-lg-none' }); $('body').append($mobile_nav); $('body').prepend(''); $('body').append('
'); $(document).on('click', '.mobile-nav-toggle', function (e) { $('body').toggleclass('mobile-nav-active'); $('.mobile-nav-toggle i').toggleclass('fa-reorder fa-remove'); $('.mobile-nav-overly').toggle(); }); $('.mobile-nav .drop-down > a i').on('click', function (e) { e.preventdefault(); $(this).parent().next().slidetoggle(300); // $(this).parent().next().toggleclass('active'); return false }); $(document).click(function (e) { var container = $(".mobile-nav, .mobile-nav-toggle"); if (!container.is(e.target) && container.has(e.target).length === 0) { if ($('body').hasclass('mobile-nav-active')) { $('body').removeclass('mobile-nav-active'); $('.mobile-nav-toggle i').toggleclass('fa-reorder fa-remove'); $('.mobile-nav-overly').fadeout(); } } }); } else if ($(".mobile-nav, .mobile-nav-toggle").length) { $(".mobile-nav, .mobile-nav-toggle").hide(); } // back to top button $(window).scroll(function () { if ($(this).scrolltop() > 100) { $('.back-to-top').fadein('slow'); } else { $('.back-to-top').fadeout('slow'); } }); $('.back-to-top').click(function () { $('html, body').animate({ scrolltop: 0 }, 1500, 'easeinoutexpo'); return false; }); })(jquery); //banner var banner = new swiper("#banner .swiper-container", { autoplay: 300, autoplay: { delay: 3600, stoponlastslide: false, disableoninteraction: false, }, speed: 1000, loop: true, navigation: { nextel: ".banner-next", prevel: ".banner-prev", }, pagination: { el: "#banner .swiper-pagination", clickable: true, }, }); //手机banner var banner = new swiper("#mob-banner .swiper-container", { autoplay: 300, autoplay: { delay: 3600, stoponlastslide: false, disableoninteraction: false, }, speed: 1000, loop: true, navigation: { nextel: ".banner-next", prevel: ".banner-prev", }, pagination: { el: "#mob-banner .swiper-pagination", clickable: true, }, });