$(document).ready(function () { //滚动事件监听 var befor_scroll = 0; $(document).scroll(function () { //当前滚动条位置 let scroll_top = $(document).scrollTop(); //窗口高度 let window_top = $(window).height(); //导航栏动画 animation_nav(scroll_top, window_top, befor_scroll) //右侧联系我们浮动模块 animation_right(scroll_top, window_top, befor_scroll) //宣传片滚动一屏动画 animation_prevue(scroll_top, window_top, befor_scroll) //关于我们动画 animation_about(scroll_top, window_top, befor_scroll) //金川数据动画 animation_datum(scroll_top, window_top, befor_scroll) //金川新闻资讯 animation_news(scroll_top, window_top, befor_scroll) //金川社会责任 animation_social(scroll_top, window_top, befor_scroll) //异步将高度存储下来 setTimeout(function () { befor_scroll = scroll_top; }, 0) }) setTimeout(function () { $("html,body").animate({scrollTop: 0}); }, 0) //地图相关动画 let map_items = $(".distribution-map .items .item") map_items.each(function (index,item) { let textpoint = $(item).attr('data-value').split(',') let id = $(item).attr('data-id') $(item).css('left',textpoint[0]+'px') $(item).css('top',textpoint[1]+'px') if (id==='0'){ $(item).css('cursor','auto') } // 添加闪光点 let point_status = $($(item).children('div')[0]).attr('data-ps') if (point_status==='1'){ let point = $($(item).children('div')[0]).attr('data-point').split(',') $('.distribution-map .items').append('
') } }) map_items.mouseover(function (e) { e.stopPropagation(); let title = $(e.currentTarget).find('span').html(); if($(e.currentTarget).attr('data-status')==='0'){ return false; } $('.map-item-introduce__img').attr('src',$(e.currentTarget).attr('data-url')) $('.map-item-introduce__title').html(title) $('.map-item-introduce__text').html($(e.currentTarget).find('div').html()) let introduce = $('.map-item-introduce') let itempoint = $($(e.currentTarget).children('div')[0]).attr('data-value').split(',') introduce.css('display','flex') introduce.css('transition','all .3s') introduce.css('opacity',1) introduce.css('left',itempoint[0]+'px') introduce.css('top',itempoint[1]+'px') }) map_items.click(function (e) { e.stopPropagation(); let id = $(e.currentTarget).attr('data-id') if (id!=='0'){ opennews(id) } }) $(".distribution-map .items").click(function (e) { let mapitem = $('.map-item-introduce') mapitem.css('opacity','0') mapitem.css('display','none') }) // 产品与服务切换 let explain__title_dom = $('.products-explain__title') let explain__text_dom = $('.products-explain__text') let products_dom = $('.section-products') let products_more_dom = $('.products-learn-more') $('.round-button').click(function (e){ $('.item-active').removeClass('item-active'); $(this).addClass('item-active') let explain__title = $(this).parent().children('.round-text').html() let explain__text = $(this).parent().children(".round-text").attr('data-value') let background__url = $(this).attr('data-value') let more__url = $(this).attr('data-url') products_dom.css('backgroundImage',"url('"+background__url+"')") explain__title_dom.html(explain__title) explain__text_dom.html(explain__text) products_more_dom.attr('data-url',more__url) }) $('.products-learn-more').click(function (e) { openurl($(this).attr('data-url')) }) $('.round-button').eq(0).click() // 实时监测鼠标位置 document.onmousemove=function (e) { //获取鼠标位置 let innerheight = window.event.view.innerHeight; let innerwidth = window.event.view.innerWidth; let x=window.event.x; let y=window.event.y; products_dom.css('backgroundPosition',''+(x/innerwidth)*100+'% '+(y/innerheight)*100+'%') } })