/*JQ回顶部*/ $(function(){$('.qz_top').hide();$(window).scroll(function(){ if($(this).scrollTop()>100){$('.qz_top').fadeIn();}else{$('.qz_top').fadeOut();}}); $('.qz_top a').click(function(){$('html ,body').animate({scrollTop: 0},100);return false;});}); /*领导致辞切换*/ $(document).ready(function(){$('.Home_about_ldzc_qh:first').addClass('active');$('.ldzc_li:first').css('display','block');autoroll();hookThumb();}); var i=-1;var offset=3000;var timer = null; function autoroll(){n = $('.Home_about_ldzc_qh').length-1;i++;if(i > n){i = 0;}slide(i);timer = window.setTimeout(autoroll, offset);} function slide(i){$('.Home_about_ldzc_qh').eq(i).addClass('active').siblings().removeClass('active');$('.ldzc_li').eq(i).css('display','block').siblings('.ldzc_li').css('display','none');} function hookThumb(){$('.Home_about_ldzc_qh').hover(function (){if (timer) {clearTimeout(timer);i = $(this).prevAll().length;slide(i); }},function () {timer = window.setTimeout(autoroll, offset); this.blur();return false;}); } /*首页幻灯片自动切换*/ var curIndex =0; var timeInterval =3000;var arr = new Array();arr[0] = "upload/index_hdp_1.jpg";arr[1] = "upload/index_hdp_2.jpg";arr[2] = "upload/index_hdp_3.jpg";arr[3] = "upload/index_hdp_4.jpg";setInterval(changeImg, timeInterval);function changeImg() {var obj = document.getElementById("Home_picqh");if (curIndex == arr.length - 1) {curIndex = 0;} else {curIndex += 1;}obj.style.backgroundImage= "URL("+arr[curIndex]+")";} //点击图片放大 var wxScale=new WxScale({fullPage:document.querySelector("#img_fd"),canvas:document.querySelector("#canvas")});var imgBox=document.querySelectorAll("#src-fd");for(var i=0; i < imgBox.length; i++){imgBox[i].onclick=function(e){ wxScale.start(this); /*这里的this指向需要放大的这张图片*/ }} //加载提示 var _LoadingHtml = '
页面加载中...
'; document.write(_LoadingHtml); document.onreadystatechange = completeLoading; function completeLoading() {if (document.readyState == "complete") {var loadingMask = document.getElementById('loadingDiv');loadingMask.parentNode.removeChild(loadingMask);}} //PIC异步加载 window.Echo=(function(window,document,undefined){'use strict';var store=[],offset,throttle,poll;var _inView=function(el){var coords=el.getBoundingClientRect();return((coords.top>=0&&coords.left>=0&&coords.top)<=(window.innerHeight||document.documentElement.clientHeight)+parseInt(offset));};var _pollImages=function(){for(var i=store.length;i--;){var self=store[i];if(_inView(self)){self.src=self.getAttribute('data-echo');store.splice(i,1);}}};var _throttle=function(){clearTimeout(poll);poll=setTimeout(_pollImages,throttle);};var init=function(obj){var nodes=document.querySelectorAll('[data-echo]');var opts=obj||{};offset=opts.offset||0;throttle=opts.throttle||250;for(var i=0;i<nodes.length;i++){store.push(nodes[i]);}_throttle();if(document.addEventListener){window.addEventListener('scroll',_throttle,false);}else{window.attachEvent('onscroll',_throttle);}};return{init:init,render:_throttle};})(window,document);/*载入页面*/Echo.init({offset:0,throttle:0});