// JavaScript Document (function($){ $.fn.myScroll = function(options){ //默认配置 const defaults = { speed:40, //滚动速度,值越大速度越慢 rowHeight:24 //每行的高度 }; let opts = $.extend({}, defaults, options) let intId = []; function marquee(obj, step){ obj.find("ul").animate({ marginTop: '-=1' },0,function(){ let s = Math.abs(parseInt($(this).css("margin-top"))); if(s >= step){ $(this).find("li").slice(0, 1).appendTo($(this)); $(this).css("margin-top", 0); } }); } this.each(function(i){ let sh = opts["rowHeight"]; let speed = opts["speed"]; let _this = $(this); const ulHeight = _this.find("ul").height(); const currentHeight = _this.height(); intId[i] = setInterval(function(){ ulHeight <= currentHeight ? clearInterval(intId[i]) : marquee(_this, sh) }, speed); _this.hover(function(){ clearInterval(intId[i]); },function(){ intId[i] = setInterval(function(){ ulHeight <= currentHeight ? clearInterval(intId[i]) : marquee(_this, sh) }, speed); }); }); } })(jQuery); $(function () { const getCurrentDate = () => { const today = new Date(); function ItArray() { this.length = ItArray.arguments.length for (let i = 0; i < this.length; i+=1) { this[i + 1] = ItArray.arguments[i] } } const d = new ItArray("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); const dateStr = today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日 " + (d[today.getDay() + 1]) $('.header-box-top-date').text(dateStr) } getCurrentDate() const mainLinkBlockBox = $('.main-link-block-box') const mainLinkMenuLi = $('.main-link-menu-li') mainLinkMenuLi.hover(function() { const index = $(this).index() $(this).addClass('menu-active').siblings().removeClass('menu-active') mainLinkBlockBox.eq(index).css({display: 'flex'}).siblings().hide() }) const mainInfoLeftNavTitle1 = $('.main-info-toggle-nav1 .main-info-left-box-nav-title') const mainInfoLeftConList1 = $('.main-info-toggle-block1 .main-info-left-box-con-list') mainInfoLeftNavTitle1.hover(function () { const index = $(this).index() $(this).addClass('info-active').siblings().removeClass('info-active') mainInfoLeftConList1.eq(index).show().siblings().hide() }) const mainInfoLeftNavTitle2 = $('.main-info-toggle-nav2 .main-info-left-box-nav-title') const mainInfoLeftConList2 = $('.main-info-toggle-block2 .main-info-left-box-con-list') mainInfoLeftNavTitle2.hover(function () { const index = $(this).index() $(this).addClass('info-active').siblings().removeClass('info-active') mainInfoLeftConList2.eq(index).show().siblings().hide() }) const mainInfoLeftNavTitle3 = $( ".main-info-toggle-nav3 .main-info-left-box-nav-title1" ); const mainInfoLeftConList3 = $( ".main-info-toggle-block3 .main-info-left-box-con-list" ); mainInfoLeftNavTitle3.hover(function () { const index = $(this).index(); $(this).addClass("info-active").siblings().removeClass("info-active"); mainInfoLeftConList3.eq(index).show().siblings().hide(); }); const mainInfoLeftNavTitle4 = $( ".main-info-toggle-nav3 .main-dang-left-box-nav-title1" ); const mainInfoLeftConList4 = $( ".main-info-toggle-block3 .main-info-left-box-con-list" ); mainInfoLeftNavTitle4.hover(function () { const index = $(this).index(); $(this).addClass("info-active").siblings().removeClass("info-active"); mainInfoLeftConList4.eq(index).show().siblings().hide(); }); //下载专区和交流活动的tab切换 const mainInfoLeftNavTitle5 = $( ".main-info-toggle-nav .main-platform-box-nav-title" ); const mainInfoLeftConList5 = $( ".main-info-toggle-block .main-platform-box-detail-list" ); mainInfoLeftNavTitle5.hover(function () { const index = $(this).index(); $(this).addClass("info-active").siblings().removeClass("info-active"); mainInfoLeftConList5.eq(index).show().siblings().hide(); }); //太阳成集团tyc122cc入口右边通知公告和部门预决算tab切换 const mainInfoLeftNavTitle6 = $( ".main-info-toggle-nav3 .main-content-box-news-title1" ); const mainInfoLeftConList6 = $( ".main-info-toggle-block6 .main-info-right-box-con-list" ); mainInfoLeftNavTitle6.hover(function () { const index = $(this).index(); $(this).addClass("info-active").siblings().removeClass("info-active"); mainInfoLeftConList6.eq(index).show().siblings().hide(); }); // const mainTeamBoxListLi = $('.main-team-box-list-li') // mainTeamBoxListLi.hover(function () { // $(this).addClass('anim-flipInX').siblings().removeClass('anim-flipInX') // }, function (e) { // // const currentTarget = e.currentTarget // // if ($(currentTarget).hasClass('anim-flipInX')) { // // setTimeout(function () { // // $(currentTarget).removeClass('anim-flipInX') // // }, 1000) // // } // }) const mainInfoRightListLiBoxLinks = $('.main-info-right-list-li-box-link a') mainInfoRightListLiBoxLinks.hover(function () { $(this).addClass('anim-flipInY').siblings().removeClass('anim-flipInY') }) const headerBanner = new Swiper('.header-banner-top-box', { autoplay: { delay: 2500, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, }); const mainBanner = new Swiper('.main-banner', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }); const mainBoxBanner = new Swiper('.main-content-box-banner', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, pagination: { el: '.main-content-box-banner .swiper-pagination', clickable: true, }, }); const mainSceneryBanner = new Swiper('.main-scenery-banner', { slidesPerView: 5, spaceBetween: 10, autoplay: { delay: 3000, disableOnInteraction: false, }, loop : true, navigation: { nextEl: '.main-scenery-banner .swiper-button-next', prevEl: '.main-scenery-banner .swiper-button-prev', }, }); const mainScienceBanner = new Swiper('.main-science-block-banner', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, pagination: { el: '.main-science-block-banner-pagination', clickable: true, }, }); const mainScienceExpert = new Swiper('.main-science-block-expert', { slidesPerView: 3, spaceBetween: 30, autoplay: { delay: 3000, disableOnInteraction: false, }, pagination: { el: '.main-science-block-expert .swiper-pagination', clickable: true, }, // navigation: { // nextEl: '.swiper-button-next', // prevEl: '.swiper-button-prev', // }, }); const mainScienceHot = new Swiper('.main-science-info-left-hot', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, pagination: { el: '.main-science-info-left-hot .swiper-pagination', clickable: true, }, }); const insideBanner = new Swiper('.main-inside-right-box-banner', { direction : 'vertical', autoplay: { delay: 3000, disableOnInteraction: false, }, // loop : true, on: { slideChangeTransitionEnd: function(){ mainInsideRightPagination.eq(this.activeIndex).addClass('active').siblings().removeClass('active') }, }, }); const mainDangBoxBanner = new Swiper('.main-dang-box-banner', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }); const mainPlatformBoxBanner = new Swiper('.main-platform-box-banner', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true }); const mainPlatformInflowBanner = new Swiper('.main-platform-box-inflow-cen-banner', { autoplay: { delay: 3000, disableOnInteraction: false, }, effect : 'fade', fadeEffect: { crossFade: true, }, loop : true, navigation: { nextEl: '.main-platform-box-inflow-cen-banner-next', prevEl: '.main-platform-box-inflow-cen-banner-prev', }, }); const mainInsideRightPagination = $('.main-inside-right-pagination > a'); mainInsideRightPagination.mouseenter(function(){ const index = $(this).index() insideBanner.slideTo(index);//切换到第一个slide,速度为1秒 $(this).addClass('active').siblings().removeClass('active') }) $('.notify-scroll').myScroll({ speed: 70, //数值越大,速度越慢 rowHeight: 30 //li的高度 }); const suspensionBoxClose = $('.suspension-close'); const suspensionBoxArrow = $('.suspension-arrow'); const suspension = $('.suspension'); suspensionBoxClose.click(function () { suspension.css({ right: -180 }) suspensionBoxArrow.fadeIn() }) suspensionBoxArrow.click(function () { suspension.css({ right: 30 }) suspensionBoxArrow.fadeOut() }) const mainScienceBlankNotifyTabTitle = $('.main-science-blank-notify-tab-title') const mainScienceBlankNotifyCenterBox = $('.main-science-blank-notify-center-box') mainScienceBlankNotifyTabTitle.hover(function() { const index = $(this).index() $(this).addClass('active').siblings().removeClass('active') mainScienceBlankNotifyCenterBox.eq(index).show().siblings().hide() }) // 移除所有固定样式 const mainDetails = $('.main-details-content'); const removeElAttr = (el) => { const child = Array.from(el.children()) child.forEach(x => { const len = $(x).children() const content = $(x).text() if (!content) { $(x).removeAttr('style') } else { if (len.length) { removeElAttr($(x)) } $(x).css({ 'font-family': '', 'font-size': '', 'line-height': '2em', 'margin': '', 'padding': '', 'text-indent': '2em' }) } }) } removeElAttr(mainDetails) // 针对所有a标签添加_blank target="_blank" const aList = $('a') aList.each((i, x) => { const href = $(x).attr('href') if (href !== '/') { $(x).attr({ target: '_blank' }) } }) // if (mainDetails.length) { // const search = location.search.substr(1).split('&').map(x => x.split('=')).reduce((pre, cur) => { // pre[cur[0]] = cur[1] // return pre // }, {}) // if (search.typeid !== '15') { // const html = mainDetails.html() // const reg = new RegExp(/(src=")/g); // const newHtml = html.replace(reg,"$1"); // mainDetails.html(newHtml) // } // } //}) //侧边栏 科技成果子菜单切换 const $nddbxcgList = $('.nddbxcg-list-wrap') const $nddbxcgTitle = $nddbxcgList.find('.nddbxcg-list-title'); const $content = $nddbxcgList.find('.nddbxcg-list-content') if($nddbxcgTitle.hasClass('active')){ $content.show(); }else{ $content.hide(); } $nddbxcgTitle.on('click',function(){ const $this = $(this); $this.toggleClass('active') if($this.hasClass('active')){ $content.show(); }else{ $content.hide(); } }) // 广告浮动插件 ;(function ($) { $.fn.adFloat = function (options) { return new AdFloat(this, options) } var AdFloat = function (element, options) { this.element = $(element) this.options = $.extend( { width: 134, //默认的广告的宽 height: 160, //默认的广告的高 top: 0, //默认的广告的Y坐标 left: 0, //默认的广告的X坐标 delay: 30, //延迟 step: 4, //默认的广告每次移动的距离(像素) }, options, ) this.interval = null this.xPos = this.options.left this.yPos = this.options.top this.yon = 0 this.xon = 0 this.isPause = false this.init() } AdFloat.prototype = { init: function () { var me = this me.element.css('display', 'block') me.element.css({ position: 'absolute', left: me.options.left, top: me.options.top, width: me.options.width, height: me.options.height, overflow: 'hidden', }) me.element.hover( function () { clearInterval(me.interval) }, function () { me.interval = setInterval(function () { me.changePos() }, me.options.delay) }, ) $(document).ready(function () { me.start() }) }, changePos: function () { var me = this var clientWidth = $(window).width() var clientHeight = $(window).height() var Hoffset = me.options.height var Woffset = me.options.width me.element.css({ left: me.xPos + $(document).scrollLeft(), top: me.yPos + $(document).scrollTop() }) if (me.yon) { me.yPos = me.yPos + me.options.step } else { me.yPos = me.yPos - me.options.step } if (me.yPos < 0) { me.yon = 1 me.yPos = 0 } if (me.yPos >= clientHeight - Hoffset) { me.yon = 0 me.yPos = clientHeight - Hoffset } if (me.xon) { me.xPos = me.xPos + me.options.step } else { me.xPos = me.xPos - me.options.step } if (me.xPos < 0) { me.xon = 1 me.xPos = 0 } if (me.xPos >= clientWidth - Woffset) { me.xon = 0 me.xPos = clientWidth - Woffset } }, start: function () { var me = this me.element.css('top', me.yPos) me.interval = setInterval(function () { me.changePos() }, me.options.delay) }, } })(jQuery) // 二维码滚动展示 $('#draggableImg').adFloat({width:150,height:130,top:0,left:0,delay:50,step:1}); // 点击关闭按钮,清除二维码 $('.draggable_close_btn').eq(0).click(function(){$('#draggableImg').remove()}) })