$(function() { function replaceLink(url) { var link = url.replace('https://www.yoursite.com/','https://xww.bucm.edu.cn/') return link; } // 添加时间戳 var timestamp = new Date().getTime(); // $.ajax({ // type: "get", // // url: "static2024/json/bzyyw.json", // url: "/commonxww/bzyyw.json" + '?t=' + timestamp, // async: false, // success: function (res) { // var data = res.data.slice(0,2); // var html = ''; // for(var i=0;i'; // html += '
'; // html += '
' + data[i].publishDate.substr(0,10) +'
'; // html += '
' + data[i].title +'
'; // if( data[i].summary ){ // html += '
' + data[i].summary +'
'; // }else{ // html += '
'; // } // html += ''; // } // $('.index_01 ul').html(html); // } // }); // $.ajax({ // type: "get", // // url: "static2024/json/xwgl.json", // url: "/commonxww/xwgl.json" + '?t=' + timestamp, // async: false, // success: function (res) { // var data1 = [],data2 = []; // var dataNum1 = 0,dataNum2 = 0; // for(var i=0;i= 2 && dataNum2 >= 5 ){ // break; // } // } // var html = ''; // for(var i=0;i'; // html += '
'; // html += '
' + data1[i].title +'
'; // } // $('.index_02a ul').html(html); // var html = ''; // for(var i=0;i
'; // html += '
' + data2[i].publishDate.substr(8,2) +'
'; // html += '
' + data2[i].publishDate.substr(0,7) +'
'; // html += '
' + data2[i].title +'
'; // } // $('.index_02b ul').html(html); // } // }); $.ajax({ type: "get", // url: "static2024/json/mtbzy.json", url: "/commonxww/mtbzy.json" + '?t=' + timestamp, async: false, success: function (res) { var data = res.data.slice(0,5); var html = ''; for(var i=0;i'; if( data[i].channelName ){ html += '
' + data[i].channelName +'
'; }else{ html += '
'; } html += '
' + data[i].title +'
'; } // $('.index_02c ul').html(html); } }); // $.ajax({ // type: "get", // // url: "static2024/json/rcpy.json", // url: "/commonxww/rcpy.json" + '?t=' + timestamp, // async: false, // success: function (res) { // var data = []; // var dataNum1 = 0; // for(var i=0;i= 3 ){ // break; // } // } // var html = ''; // for(var i=0;i'; // html += '
'; // html += '
' + data[i].title +'
'; // } // $('.index_03 ul').html(html); // } // }); function home_swiper_index(x) { if (x == 0) { // 首屏 $('.home_swiper').addClass('first_screen').removeClass('not_first_screen'); $('.aside_link').removeClass('on'); $('.header').removeClass('currents'); } else { // 非首屏 $('.home_swiper').addClass('not_first_screen').removeClass('first_screen'); $('.aside_link').addClass('on'); $('.header').addClass('currents') } setTimeout(function() { enterEffects(); }, 800); } if( $(window).width() > 996 ){ var screenIndex = 0; $(".home_slide").mousewheel(function(event, delta, deltaX, deltaY) { if (delta > 0 && $(".home_slide").scrollTop() == 0) { screenIndex = 0; home_swiper_index(screenIndex); } }); $(".wrapbanner").mousewheel(function(event, delta, deltaX, deltaY) { if (delta < 0) { screenIndex = 1; home_swiper_index(screenIndex); } }); // 触屏滑动 var startX, startY, moveEndX, moveEndY, X, Y; $(".wrapbanner").on("touchstart", function(e) { startX = e.originalEvent.changedTouches[0].pageX, startY = e.originalEvent.changedTouches[0].pageY; }); $(".wrapbanner").on("touchend", function(e) { moveEndX = e.originalEvent.changedTouches[0].pageX, moveEndY = e.originalEvent.changedTouches[0].pageY, X = startX - moveEndX , Y = startY - moveEndY ; if (Y > 0 && Math.abs(Y) > Math.abs(X) ) { screenIndex = 1; home_swiper_index(screenIndex); } }); $(".home_slide").on("touchstart", function(e) { startX = e.originalEvent.changedTouches[0].pageX, startY = e.originalEvent.changedTouches[0].pageY; }); $(".home_slide").on("touchend", function(e) { moveEndX = e.originalEvent.changedTouches[0].pageX, moveEndY = e.originalEvent.changedTouches[0].pageY, X = startX - moveEndX , Y = startY - moveEndY ; if (Y < 0 && Math.abs(Y) > Math.abs(X) && $(".home_slide").scrollTop() == 0) { screenIndex = 0; home_swiper_index(screenIndex); } }); // $('.home_side_fix .gotop').click(function() { // $('.home_slide').animate({ // scrollTop: 0 // }, 700); // home_swiper.slideTo(0, 700, false); // }); } $('.home_slide').scroll(function(){ enterEffects(); var _this = $('.index_05a .hasvideo'); var enterEffects_y = getPosition(_this[0]).y; if( enterEffects_y <= $(window).height() * .85 && _this.find('video').length == 0 ){ _this.html('') } }); $(window).scroll(function(){ var _this = $('.index_05a .hasvideo'); var enterEffects_y = getPosition(_this[0]).y; if( enterEffects_y <= $(window).height() * .85 && _this.find('video').length == 0 ){ _this.html('') } }); var BannerSwiper = new Swiper('.banner', { autoplay: { delay: 5000, disableOnInteraction: false }, slidesPerView: 1, loop: true, pagination: { el: '.wrapbanner .swiper-pagination', clickable: true, renderBullet: function (index, className) { switch(index){ case 0:text='壹';break; case 1:text='贰';break; case 2:text='叁';break; case 3:text='肆';break; case 4:text='伍';break; } return '' + text + ''; }, }, // navigation: { // nextEl: '.wrapbanner .next', // prevEl: '.wrapbanner .prev', // }, lazy: { loadPrevNext: true, elementClass : 'swiper-lazy', loadOnTransitionStart: true, }, on: { init: function(swiper) { play_swiper_video('.banner'); }, slideChangeTransitionEnd: function(swiper) { play_swiper_video('.banner'); } } }) $('.index_07b ul').addClass('swiper-wrapper'); $('.index_07b li').addClass('swiper-slide'); var index_07b = new Swiper('.index_07b', { autoplay: { delay: 5000, disableOnInteraction: false }, slidesPerView: 2, loop: true, spaceBetween: 0, breakpoints: { 100: { slidesPerView: 2, spaceBetween: 0 }, 767: { slidesPerView: 3, spaceBetween: 0 }, 996: { slidesPerView: 5, spaceBetween: 0 }, 1480: { slidesPerView: 7, spaceBetween: 0 } } }); $('.index_07c ul').addClass('swiper-wrapper'); $('.index_07c li').addClass('swiper-slide'); var index_07c = new Swiper('.index_07c', { autoplay: { delay: 5000, disableOnInteraction: false }, slidesPerView: 2, loop: true, spaceBetween: 0, breakpoints: { 100: { slidesPerView: 2, spaceBetween: 0 }, 767: { slidesPerView: 3, spaceBetween: 0 }, 996: { slidesPerView: 5, spaceBetween: 0 }, 1480: { slidesPerView: 7, spaceBetween: 0 } } }); $('.index_08 ul').addClass('swiper-wrapper'); $('.index_08 li').addClass('swiper-slide'); var index_08 = new Swiper('.index_08', { autoplay: { delay: 5000, disableOnInteraction: false }, navigation: { nextEl: '.index_08 .next', prevEl: '.index_08 .prev', }, slidesPerView: 'auto', loop: true, spaceBetween: 0, }); $('.index_09 ul').addClass('swiper-wrapper'); $('.index_09 li').addClass('swiper-slide'); var Swiper_index_09 = new Swiper('.index_09', { autoplay: false, slidesPerView: 'auto', loop: false, spaceBetween: 0, freeMode: true, }); var index_09_width = 0; $('.index_09 li').each(function(){ index_09_width += $(this).outerWidth(true); }); index_09_width -= $(window).width(); $('.home_slide').scroll(function(){ if( getPosition('.index_09').y <= $(window).height() * .85 && getPosition('.index_09').y >= 0 ){ var _scroll = ( getPosition('.index_09').y / ($(window).height() * .85) - 1 ) * index_09_width; Swiper_index_09.translateTo( _scroll , 0, false, false); } if( getPosition('.index_09').y < 0 ){ Swiper_index_09.translateTo( 0 , 0, false ); console.log(0) } }) $('.wrap_mode09').mousemove(function(e){ var x = e.clientX; $('.index_09 i').each(function(){ var dis = Math.abs( x - $(this).offset().left ); if( dis < 60 ){ $(this).css('transform','translateY('+ ( dis - 60 ) * .8 +'px)'); }else{ $(this).css('transform','translateY(0)'); } }) }); });