/** * Created by wangzhiwei on 2019/6/20. */ function initAboutPage() { var lists = ""; $(".view-grouping").each(function (i) { var year = $(this) .find(".view-grouping-header") .find("span.date-display-single") .text(); var _class = i == 0 ? "active" : ""; lists += '
  • ' + year + "
  • "; }); $(".honor-nav ul").html(lists); $(".honor .view-grouping").eq(0).show().siblings(".view-grouping").hide(); $(".honor-nav").on("click", "li.font-barlow", function () { var index = $(this).index(); $(".honor .view-grouping") .eq(index) .show() .siblings(".view-grouping") .hide(); $(".honor-nav li.font-barlow a").removeClass("active"); $(this).find("a").addClass("active"); }); // $(".about-container .swiper-slide").each(function () { // var imgSrc = $(this).find("img").attr("src") // $(this).css({ // 'background': 'url(' + imgSrc + ') no-repeat center center', // 'background-size': 'cover' // }) // }) } function showVideo(videoUrl) { showDialog("videoDialog"); $("#videoDialog #plVideo").attr("src", videoUrl); document.getElementById("plVideo").play(); // $("#videoDialog .dialog-content").html('') } function closeVideo() { hideDialog("videoDialog"); $("#videoDialog #plVideo").attr("src", ""); } $(function () { initAboutPage(); $(".videobox a.play").click(function (event) { event.preventDefault(); var videoUrl = $(this).attr("href"); showVideo(videoUrl); }); var bannerContainer = $(".banner-container").length && new Swiper(".banner-container", { watchOverflow: true, parallax: true, mousewheel: true, speed: 1000, loop: true, preloadImages: false, loopedSlides: 5, // updateOnImagesReady: true, autoplay: { delay: 5000, }, effect: "fade", fadeEffect: { crossFade: true, }, // autoHeight: true, pagination: { el: ".swiper-pagination", //自动隐藏 clickable: true, // type: "custom", // renderCustom: function(swiper, current, total) { // return current + " / " + total; // }, }, navigation: { nextEl: ".swiper-button-next", //自动隐藏 prevEl: ".swiper-button-prev", //自动隐藏 }, on: { init: function () { /* frontVideo.play(); frontVideo.addEventListener("ended", function () { $("body").addClass("slide-in"); })*/ }, }, }); function initCeoPagination() { var len = $(".banner-container .swiper-slide").length - bannerContainer.loopedSlides * 2; var navNumSlides = ""; for (var i = 0; i < len; i++) { var ni = i + 1 < 10 ? "0" + (i + 1) : i + 1; navNumSlides += '
    ' + ni + "
    "; } $(".ceo-pagination-container .swiper-wrapper").html(navNumSlides); } initCeoPagination(); var ceoPagination = new Swiper(".ceo-pagination-container", { speed: 1000, loop: true, mousewheel: true, direction: "vertical", slidesPerView: 3, loopedSlides: 5, // autoplay: true, centeredSlides: true, centeredSlidesBounds: true, }); if ($(".ceo-pagination-container").length) { bannerContainer.controller.control = ceoPagination; //Swiper1控制Swiper2,需要在Swiper2初始化后 ceoPagination.controller.control = bannerContainer; //Swiper2控制Swiper1,需要在Swiper1初始化后 } });