(function($){ $.fn.numberrock=function(options){ var defaults={ lastnumber:100, duration:3000, easing:'swing' //swing(默认 : 缓冲 : 慢快慢) linear(匀速的) }; var opts=$.extend({}, defaults, options); $(this).animate({ num : "numberrock", },{ duration : opts.duration, easing : opts.easing, complete : function(){ // console.log("success"); }, step : function(a,b){ $(this).html(parseint(b.pos * opts.lastnumber)); } }); } })(jquery); $(document).ready(function(){ // videosize(); // scalewindow(); indexfullpage(); indexbanner(); indexbannersize(); // noticeslide(); // groupslide(); linkconwidth(); gtbrowser(); if($(".index-banner").length > 0){ var _src = $(".index-banner .swiper-slide-active").find("img").attr('src'); $(".left-nav").css({'background':'url('+_src+') no-repeat'}) function videosize(){ // var winwidth = $(window).width()+200; //浏览器宽度 // var winheight = $(window).height()+200; //浏览器高度 var _w = $(".indexshowvideo-con").find(".opcity").width()+100; var _h = $(".indexshowvideo-con").find(".opcity").height()+100; $(".indexshowvideo").find("video").css({'width':_w,'height':_h}); $("#indexvideo").css({'width':_w,'height':_h,'margin-top':-_h/2,'margin-left':-_w/2}); } videosize(); $(window).resize(function(){ videosize(); }) } $('#loading-iframe').css('display','none') var tab_swiper1=null,tab_swiper2=null,tab_swiper3=null; tab_swiper1=new swiper ('#section4_swiper1', { slidesperview: 3, spacebetween: 30, slidespergroup: 3, // 如果需要前进后退按钮 navigation: { nextel: '#section4_button_next1', prevel: '#section4_button_prev1', } }) tab_swiper2=new swiper ('#section4_swiper2', { slidesperview: 3, spacebetween: 30, slidespergroup: 3, // 如果需要前进后退按钮 navigation: { nextel: '#section4_button_next2', prevel: '#section4_button_prev2', } }) tab_swiper3=new swiper ('#section4_swiper3', { slidesperview: 3, spacebetween: 30, slidespergroup: 3, // 如果需要前进后退按钮 navigation: { nextel: '#section4_button_next3', prevel: '#section4_button_prev3', } }) new swiper ('.section5_swiper', { loop : true, // autoplay:true, pagination: { el: '.section5_swiper .pagination', type: 'fraction', }, // 如果需要前进后退按钮 navigation: { nextel: '#section5_button_next', prevel: '#section5_button_prev', }, on:{ slidechange: function(){ $(".section5_swiper .swiper-slide .swiper-slide_video").each(function (i,item) { $(item)[0].pause() }) $(".section5_swiper .swiper-slide .swiper-slide_video").attr('controls',false) $(".section5_swiper .swiper-slide .video_play").css('display','block') }, } }) $('.section4_tab_warp').addclass('hidden') $('.section4_tab_warp').eq(0).removeclass('hidden') $('.section4_tab').click(function(){ var index=$(this).index() $(this).addclass('active').siblings().removeclass('active') $('.section4_tab_warp').eq(index).removeclass('hidden').siblings().addclass('hidden') }) }); $(window).resize(function(){ indexbannersize(); linkconwidth(); }); //fullpage function indexfullpage(){ $("#fullpage").fullpage({ anchors: ['firstpage', 'secondpage', 'thirdpage', 'fourthpage', 'fifthpage','sixpage','seventhpage','eighthpage'], menu: '#menu', scrollingspeed:400, navigation:true, navigationposition:'right', css3:true, fittosection: true, resize : false, verticalcentered:false, onleave: function(anchorlink, index){ $(".nav-gotop .redline").height(15*index+'px'); if(index === 1){ $(".nav-gotop .redline").height(0); $(".headercon").addclass("animation"); $("#fullpage .section#section1").css('overflow','inherit') }else if(index === 6){ var _txt1 = $(".counter1").attr('data-val'); var _txt2 = $(".counter2").attr('data-val'); var _txt3 = $(".counter3").attr('data-val'); var _txt4 = $(".counter4").attr('data-val'); $(".counter1").numberrock({ lastnumber:_txt1, duration:2000, easing:'swing', }); $(".counter2").numberrock({ lastnumber:_txt2, duration:2000, easing:'swing', }); $(".counter3").numberrock({ lastnumber:_txt3, duration:2000, easing:'swing', }); $(".counter4").numberrock({ lastnumber:_txt4, duration:2000, easing:'swing', }); }else{ $(".headercon").removeclass("animation"); } if(index>1){ $(".left-nav").addclass("fixed"); }else{ $(".left-nav").removeclass("fixed"); } }, afterload: function(anchorlink, index){ if(index === 1){ // $('.headercon').css({''}) $(".headercon").addclass("animation"); $(".headercon").removeclass("headersection"); }else{ $(".headercon").addclass("headersection"); $(".headercon").removeclass("animation"); $("#fullpage .section#section1").css('overflow','hidden') } } }); } function num(){ $(".counter").each(function(){ $(this).prop('counter',0).animate({ crs:$(this).text() },{ duration:2000, easing:'swing', step:function(now){ console.log(now) $(this).text(math.ceil(now)); } }) }) } //首页banner function indexbanner(){ if($(".index-banner").length > 0){ var swiper = new swiper ('.index-banner .swiper-container', { pagination: { el: '.index-banner_action .pagination', type: 'fraction', }, // nextbutton: '.index-banner .arrow-right', // prevbutton: '.index-banner .arrow-left', paginationclickable :true, autoheight: true, autoplay:true, noswiping : true, speed:800, // autoplaydisableoninteraction : false, loop : true, onslidechangestart: function(swiper){ var _src = $(".index-banner .swiper-slide-active").find("img").attr('src'); // $("body").css('background','rgba(0, 0, 0, 0.6)'+_src); $(".left-nav").css('background','url('+_src+')') } }) $('.index-banner .swiper-button-next').on('click', function(e){ e.preventdefault() swiper.slideprev() }) $('.index-banner .swiper-button-prev').on('click', function(e){ e.preventdefault() swiper.slidenext() }) } } function indexbannersize(){ var bannerimgobj = $(".dw-cont>img,.indexshowvideo-con>img"); //图片对象 var winwidth = $(window).width(); //浏览器宽度 var winheight = $(window).height(); //浏览器高度 bannerimgobj.each(function(){ var _this = $(this); //_this.css({"width":"100%","left":"50%"}); _this.css({"width":"100%"}); getimagesize(_this.attr("src"),function(w,h){ var ratio = w/h; //图片比例 var showh = winwidth/ratio; //图片显示高度 var neww; //新设置的图片宽度 if(showh < winheight){ //图片显示高度小于窗口高度 neww = winheight*ratio; _this.css({"height":"100%","width":neww}); }else{ neww = winwidth; _this.css({"width":"100%","height":"auto"}); } //_this.css({"margin-left":"-"+neww/2+"px"}); }) }); } //获取图片尺寸 function getimagesize(url,callback){ var img = new image(); img.src = url; // 如果图片被缓存,则直接返回缓存数据 if(img.complete){ callback(img.width, img.height); }else{ // 完全加载完毕的事件 img.onload = function(){ callback(img.width, img.height); } } } function noticeslide(){ // $(".txtscroll-top").slide({titcell:".hd ul",maincell:".bd ul",autopage:true,effect:"top",autoplay:true,vis:1}); } function groupslide(){ $(".picmarquee-left1,.picmarquee-left2").slide( { maincell:".bd ul", autoplay:true, effect:"leftmarquee", easing:"swing", vis:10, intertime:30 } ); $(".picmarquee-right1").slide( { maincell:".bd ul", autoplay:true, effect:"leftmarquee", easing:"swing", vis:10, opp:true, intertime:30 } ); imgscroll.rolling({ name:'g1', width:'293px', height:'168px', direction:'left', speed:30, addcss:true }); // $(".tempwrap").each(function(){ // $(this).find("li").hover(function(){ // $(this).find("span").hide(); // $(this).find("img").css('z-index','9') // },function(){ // $(this).find("span").show(); // $(this).find("img").css('z-index','0') // }) // }) } function linkconwidth(){ // var viewwidth=$(window).width(); $(".nav-link").on('mouseenter',function(){ var _width = $(".s1-con").width(); $(".link-slidecon-wrap").width(_width); }) $(".nav-link").on('mouseleave',function(){ // var _width = $(".s1-con").width(); $(".link-slidecon-wrap").width(0); }) } function gtbrowser(){ var useragent = navigator.useragent; //取得浏览器的useragent字符串 var isie = useragent.indexof("compatible") > -1 && useragent.indexof("msie") > -1; //判断是否ie<11浏览器 var isedge = useragent.indexof("edge") > -1 && !isie; //判断是否ie的edge浏览器 var isie11 = useragent.indexof('trident') > -1 && useragent.indexof("rv:11.0") > -1; if(isie) { var reie = new regexp("msie (\\d+\\.\\d+);"); reie.test(useragent); var fieversion = parsefloat(regexp["$1"]); if(fieversion == 7) { console.log(fieversion) } else if(fieversion == 8) { console.log(fieversion) } else if(fieversion == 9) { console.log(fieversion) } else if(fieversion == 10) { console.log(fieversion) } else { console.log(fieversion)//ie版本<=7 } } else if(isedge) { console.log(isedge)//edge } else if(isie11) { console.log(isie11) //ie11 }else{ // videoswiper(); // console.log("不是ie浏览器")//不是ie浏览器 } }