var istouch = modernizr.touch, ismobile = false,//区分移动端与pc端 mobile = false,//区分手机端与平板 w_width = 0, w_height = 0, bannerimgh=638, navitem = 0, h_height=0, roll=0, stop=150, produs=0, st = 0; var _mousemove; var _click; var _mousedown; var _mouseup; //移动端事件和pc事件的切换 if (modernizr.touch) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pagebox() { w_width = jquery(window).width(); w_height = jquery(window).height(); //设置移动端参数 if (w_width <= 1024) { ismobile = true; } else if (w_width > 1024) { ismobile = false; }; //区分手机端和平板 if (w_width <= 640) { mobile = true; } else if (w_width > 640) { mobile = false; }; if(ismobile){ $("body").find('.article-block').removeclass('article-block'); } } pagebox(); jquery(window).resize(function () { pagebox(); }); //link var links = { init: function() { this.setdown(); }, setdown: function() { $(".link span").click(function(){ $(this).stop().toggleclass('on'); $(".linkdown").stop().slidetoggle(); }); $(".link").mouseleave(function(){ $(".link span").removeclass('on'); $(".linkdown").stop().slideup(); }) } }; //手机导航 var navigatie = { init: function() { this.setnav(); }, setnav: function() { $('.menubtn').on('click', function(e) { e.stoppropagation(); $(this).toggleclass('active'); $(".navigation").stop().fadetoggle('show'); }); $(".navigetewr >li >a").bind("click", function (e) { var $navmobile=jquery(".navigation"), $nava=$navmobile.find(".navigetewr >li >a"), $msubnav=$navmobile.find(".navdown"); var hjcur = $(this); var hjdd = $(this).parents("li"); if (hjdd.find(".navdown").size() > 0) { if (hjdd.hasclass("on")) { hjdd.find(".navdown").stop(false, false).slideup(); hjdd.removeclass("on"); } else { $nava.parents('li').removeclass("on"); $msubnav.stop(false, false).slideup(); hjdd.find(".navdown").stop(false, false).slidedown(); hjdd.addclass("on"); e.preventdefault(); } } }); } }; //导航hover var navhover = { init: function() { this.sethover(); }, sethover: function() { var index1=$(".navs >li.active").index(); $(".navs >li").hover(function(){ $(this).addclass('active').siblings().removeclass('active'); },function(){ $(".navs >li").removeclass('active').eq(index1).addclass('active'); }); var index_=$(".menulist li.active").index(); $(".menulist li").hover(function(){ $(this).addclass('active').siblings().removeclass('active'); },function(){ $(".menulist li").removeclass('active').eq(index_).addclass('active'); }); $(document).ready(function(){ var indexs=$(".menulist li.active").index(); var now=$(".menulist li").width()*indexs; $(".leval-menus").animate({scrollleft:now}); var indexs1=$(".newsed li.active").index(); var now=$(".newsed li").width()*indexs1; $(".newsbg").animate({scrollleft:now}); }); } }; //内页二级导航滚动 var scollsd = { init: function() { this.setscoll1(); }, setscoll1: function() { if($(".levaldown").length>0){ function c(){ var $menustop=$(".levaldown").offset().top-$(".mtop").height(); var $footer=$(".footer-box").offset().top - ($(".levalflex").outerheight()+$(".header-box").height()+41); var s = $(window).scrolltop(); s > $menustop ? $(".levalflex").addclass("scoll"): $(".levalflex").removeclass("scoll"); s > $footer ? $(".levalflex").addclass("scollbott"): $(".levalflex").removeclass("scollbott"); } $(window).scroll(c), c(); } } }; //返回顶部 var scolltop = { init: function() { this.setback(); }, setback: function() { $(".scolltop").click(function(){ jquery("html,body").animate({ scrolltop: 0},500); }); } }; //内页banner var scollinner = { init: function() { this.setscoll(); }, setscoll: function() { jquery(window).scroll(function () { var headh=$(".header-box").outerheight(); var windowtop = jquery(window).scrolltop(); if (windowtop < w_height && !ismobile) { jquery('.pbanner figure img').css('transform', "translate(0px," + (windowtop) / 1.5 + "px)"); }; }); } }; links.setdown(); navhover.sethover(); navigatie.setnav(); scolltop.setback(); scollsd.setscoll1(); scollinner.setscoll(); jquery(window).load(function(){ jquery('.article-block').delay(300).scrollclass(); }); (function(jquery){ $.fn.scrollclass = function(config){ var defaults = {}; var config = jquery.extend(defaults, config); var target = this; function addaction(){ var length = target.length; for(var i=0; i关闭
'; $("body").append(str); jquery(".popupblack").fadein(); jquery(".popup").animate({margintop:"-127"},400); $(".popup .close").click(function () { $(".popupblack").remove(); }); jquery(".popupblack").click(function(){$(".popupblack").remove();}); return false; }); }; function setimgmax(img, imgw, imgh, tw, th) { var twidth = tw || w_width; var theight = th || w_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; };