$(function () { $("#loading").fadeOut(); AOS.init({ disable: window.innerWidth < 1000, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function startEvent: "DOMContentLoaded", // name of the event dispatched on the document, that AOS should initialize on initClassName: "aos-init", // class applied after initialization animatedClassName: "aos-animate", // class applied on animation useClassNames: false, // if true, will add content of `data-aos` as classes on scroll disableMutationObserver: false, // disables automatic mutations' detections (advanced) debounceDelay: 50, // the delay on debounce used while resizing window (advanced) throttleDelay: 99, //offset: 50, // offset (in px) from the original trigger point delay: 0, // values from 0 to 3000, with step 50ms duration: 1500, // values from 0 to 3000, with step 50ms easing: "ease", // default easing for AOS animations mirror: false, // whether elements should animate out while scrolling past them anchorPlacement: "top-bottom", // defines which position of the element regarding to window should trigger the animation }); const mbannerVideo = document.querySelectorAll(".mbanner .videos"); for (const i of mbannerVideo) { i.currentSrc == "" ? i.remove() : void 0; } //媒体 $(".main5 .source").each(function(){ if($(this).text()=="微信"){$(this).next().addClass("wx")} if($(this).text()=="微博"){$(this).next().addClass("weibo")} if($(this).text()=="bilibili"){$(this).next().addClass("bili")} if($(this).text()=="视频号"){$(this).next().addClass("sph")} if($(this).text()=="小红书"){$(this).next().addClass("xhs")} if($(this).text()=="学习强国"){$(this).next().addClass("xxqg")} if($(this).text()=="人民号"){$(this).next().addClass("rmh")} if($(this).text()=="央视频"){$(this).next().addClass("ysp")} if($(this).text()=="教育号"){$(this).next().addClass("jyh")} if($(this).text()=="快手"){$(this).next().addClass("ks")} }) var $video = $("video"); $(".mbanner .focus .ul").on("init", function (event, slick) { if ($(".mbanner .focus .ul .slick-current").find("video").size() > 0) { $(".mbanner .focus .ul .slick-current").find("video")[0].play(); $(".mbanner .focus .icon").addClass("icon_play") $(".mbanner .focus .ul .slick-current").find("video").bind("ended", function () { $(".mbanner .focus .icon").removeClass("icon_play") $(".mbanner .focus .ul").slick("slickPlay"); }); } else { setTimeout(function () { $(".mbanner .focus .slick-current .box").addClass("box2"); $(".mbanner .focus .ul").slick("slickPlay"); }, 100) } }) $("#openBtn").click(function () { $("html").toggleClass("fixed"); $(this).toggleClass("active"); $("#nav_hover").toggleClass("on"); $("#globalHeader").toggleClass("on"); }); $(".mbanner .focus .ul").slick({ autoplay: false, autoplaySpeed: 7000, speed: 800, dots: true, arrows: true, fade: true, cssEase: "cubic-bezier(0.5,0,0.3,1)", pauseOnHover: false, prevArrow: ".mbanner .prev a", nextArrow: ".mbanner .next a", // appendDots:".mbanner .nav", }); $(".mbanner .focus .ul").on("beforeChange", function (event, slick, currentSlide) { $(".mbanner .focus .box").removeClass("box2"); $(".mbanner .focus .slick-current .box").addClass("box1"); $(".mbanner .focus .box").removeClass("box0"); }); $(".mbanner .focus .ul").on("afterChange",function(event, slick, currentSlide){ $(".mbanner .focus .box").removeClass("box1"); $(".mbanner .focus .slick-current .box").addClass("box0"); if ($(".mbanner .focus .ul .slick-current").find("video").size() > 0) { $(".mbanner .focus .ul .slick-current").find("video")[0].play(); $(".mbanner .focus .icon").addClass("icon_play") $(".mbanner .focus .ul").slick("slickPause"); $(".mbanner .focus .ul .slick-current").find("video").bind("ended", function () { $(".mbanner .focus .ul").slick("slickPlay"); $(".mbanner .focus .icon").removeClass("icon_play") setTimeout(function () { $(".mbanner .focus .ul").slick("slickNext"); }, 100) }); } else { $(".mbanner .focus .ul video").each(function () { var $vd = $(this).get(0); $vd.pause(); $(".mbanner .focus .icon").removeClass("icon_play") $(".mbanner .focus .ul").slick("slickPlay"); }) } }); $(".mbanner .focus .icon").click(function(){ var _video = $('.mbanner .focus .ul .slick-active video')[0]; if(_video.paused){ $(this).addClass("icon_play"); $(".mbanner .focus .ul .slick-active video")[0].play(); }else{ $(this).removeClass("icon_play"); $(".mbanner .focus .ul .slick-active video")[0].pause(); } }) /*主大图切换*/ // $(".mbanner .news_list").slick({ // dots: true, // autoplay: true, // slide: "li", // autoplaySpeed: 8000, // infinite: true, // slidesToShow: 1, // fade: true, // slidesToScroll: 1, // prevArrow: "", // nextArrow: "", // }); $(".post-11 .news_list").slick({ dots: true, autoplay: false, slide: "li", autoplaySpeed: 4000, infinite: true, slidesToShow: 1, fade: true, slidesToScroll: 1, }); $(".post-31 .news_list").slick({ dots: false, autoplay: false, slide: "li", autoplaySpeed: 4000, infinite: true, speed: 1000, slidesToShow: 5, slidesToScroll: 1, lazyLoad: "ondemand", responsive: [ { breakpoint: 999, settings: { slidesToShow: 3, }, }, { breakpoint: 800, settings: { slidesToShow: 2, }, }, { breakpoint: 479, settings: { slidesToShow: 1, }, }, ], }); $(".dou .list").slick({ dots: true, autoplay: true, slide: "a", autoplaySpeed: 4000, infinite: false, speed: 1000, slidesToShow: 1, slidesToScroll: 1, prevArrow: "", nextArrow: "", responsive: [ { breakpoint: 1000, settings: { slidesToShow: 2, }, }, { breakpoint: 479, settings: { slidesToShow: 2, }, }, ], }); $(".post-81 .news_boxCon").slick({ dots: false, autoplay: true, slide: "ul", autoplaySpeed: 4000, infinite: false, speed: 1000, slidesToShow: 1, slidesToScroll: 1, }); var $container4 = $("#container-4"); var imgArry = []; const imgInit = $(".post-41 .news.n1 a").data("src"), hrefInit = $(".post-41 .news.n1 a").data("href"); $container4 .find(".modr .news_imgs") .attr( "style", `background: #ffff url(${imgInit}) no-repeat center; background-size: cover` ); document.querySelector("#container-4 .modr .news_imgs").onclick = () => window.open(hrefInit); $(".post-41 .news").each(function (index, el) { var _this = $(this); var _img = $(this).find("a").data("src"); var _href = $(this).find("a").data("href"); $(this).click(function () { $container4 .find(".main_logo_bg") .removeClass("n0 n1 n2 n3 n4") .addClass("n" + index + ""); $container4 .find(".modr .news_imgs").removeAttr("style") .attr( "style", `background: #fff url(${_img}) no-repeat center; background-size: cover; transform: translateY(0px);` ); document.querySelector("#container-4 .modr .news_imgs").onclick = () => window.open(_href); }); }); // $("img.lazy").lazyload({ // effect: "fadeIn", // }); var H = $(document).height() - 20; $(document).mousemove(function (e) { var pageY = e.pageY > H ? H : e.pageY; $(".cursor span").eq(0).css({ left: e.pageX, top: pageY, }); setTimeout(function () { $(".cursor span").eq(1).css({ left: e.pageX, top: pageY, }); }, 200); }); var timer = null, once = 0, twoce = 0, domsMain = { video1: document.getElementById("videos1"), video2: document.getElementById("videos2"), H: $(document), }; var container8_height = $("#container-8").height(); $(window).scroll(function (event) { var top = $(this).scrollTop(); if (top > 1900) { $(".mainpage").addClass("active"); } else { $(".mainpage").removeClass("active"); } var isShow = function (domId) { var content = document.getElementById(domId); var { top, bottom } = content.getBoundingClientRect(); var clientHeight = document.documentElement.clientHeight; return bottom > 0 && top < clientHeight; }; if (isShow("container-6")) { if (once === 0) { timer && clearTimeout(timer); timer = setTimeout(function () { new zturn({ id: "zturn", opacity: 0.9, width: 200, Awidth: 1200, scale: 0.9, // auto: true,//是否轮播 默认5000 turning: 2000, //轮播时长 }); console.log("container-6", "可见", "加载东大学人模块"); once++; }, 100); } else if (once > 1) { once = 0; } } if (isShow("container-8")) { if (twoce === 0) { domsMain.video2.currentTime = 0; domsMain.video2.play(); console.log("container-8", "可见", "视频已播放!"); twoce++; } else if (twoce > 1) { twoce = 0; } } var isShowFix = function (domId) { var content = document.getElementById(domId); var { top, bottom } = content.getBoundingClientRect(); var clientHeight = document.documentElement.clientHeight; // console.log('==可见区域===', top, bottom, clientHeight ) return bottom > 0 && top < clientHeight; // return bottom > 0 && top < clientHeight && 0-clientHeight > bottom; // return top < clientHeight && bottom > -footerHeight; }; if (isShowFix("container-7")) { $("#container-7").css({ marginBottom: container8_height }); $("#main_page3").css({ position: "fixed" }); } else { $("#container-7").css({ marginBottom: 0 }); $("#main_page3").css({ position: "relative" }); } }); //定时换肤 var maximalUpdateDelay = 25; // ms var updateTimeout, name = "main4_bg"; var bgDom = document.querySelector(".mainpage2"); function animate() { updateTimeout = setTimeout(animate, maximalUpdateDelay); var delta = (now = new Date()); var h = delta.getHours(); //0 - 23 if ((h >= 7) & (h <= 19)) { bgDom.classList.value = "mainpage2 light"; } else { bgDom.classList.value = "mainpage2 dark"; } } function main() { clearTimeout(updateTimeout); animate(); requestAnimationFrame(main); } main(); const linkDom = document.querySelectorAll(".foot-link .item"); addFirstDom(linkDom); });