var tme={}; tme.init=function(){ tme.event(); } // 配置事件 tme.event=function(){ var browser = (function(){ var ua = window.navigator.useragent.tolowercase(), sys = null, s; if(s = ua.match(/rv:([\d.]+)\) like gecko/)){sys = {type:'ie',version:s[1]};} else if(s = ua.match(/msie ([\d.]+)/)){sys = {type:'ie',version:s[1]};} else if(s = ua.match(/firefox\/([\d.]+)/)){sys = {type:'firefox',version:s[1]};} else if(s = ua.match(/chrome\/([\d.]+)/)){sys = {type:'chrome',version:s[1]};} else if(s = ua.match(/opera.([\d.]+)/)){sys = {type:'opera',version:s[1]};} else if(s = ua.match(/version\/([\d.]+).*safari/)){sys = {type:'safari',version:s[1]};} else if(s = ua.match(/ucbrowser\/([\d.]+)/)){sys = {type:'uc',version:s[1]};} else if(s = ua.match(/micromessenger\/([\d.]+)/)){sys = {type:'wx',version:s[1]};} else{sys = {type:'unknown',version:'unknown'};} sys.ismobile = !!ua.match(/applewebkit.*mobile.*!/) || !!ua.match(/(iphone|ipod|android|ios|ipad)/i); return sys; })(); /*检测ie*/ if(browser.type =="ie" && browser.version < 9){ location.href="http://outdatedbrowser.com/zh-cn"; } /*判断谷歌27*/ if(browser.type == 'chrome' && browser.version <= 27){ $('.font_scale8, .font_scale10').addclass('font_adjust'); } tme.fnbanner(); tme.fnnewsimg(); tme.fnnewstxt(); tme.fnbacktop(); tme.fnsmallnav(); tme.fnpop(); tme.fnowlcarousel(); } tme.fnsmallnav=function(){ $(".nav_btn,.mask_bg").click(function(){ $(".nav_btn").toggleclass("on"); $(".nav").toggleclass("on"); $(".mask_bg").delay(500).fadetoggle(); }) } tme.fnpop=function(){ $('.cd-popup-trigger0').on('click', function(event){ event.preventdefault(); $('.cd-popup').addclass('is-visible'); //$(".dialog-addquxiao").hide() }); //关闭窗口 $('.cd-popup').on('click', function(event){ if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup') ) { event.preventdefault(); $(this).removeclass('is-visible'); } }); //esc关闭 $(document).keyup(function(event){ if(event.which=='27'){ $('.cd-popup').removeclass('is-visible'); } }); } tme.fnowlcarousel=function(){ $('.js_business .owl-carousel').owlcarousel({ loop: true, margin: 10, responsiveclass: true, responsive: { 0: { items: 1, nav: true }, 420: { items: 2, nav: true, margin: 30 }, 992: { items: 3, nav: true, loop: true, margin: 45 } } }) } //返回顶部 tme.fnbacktop=function(){ $(window).scroll(function(){ var scrollheight=$(this).scrolltop(); if(scrollheight>10){ $(".back_topbtn").addclass("back_topbtnshow"); }else{ $(".back_topbtnshow").removeclass("back_topbtnshow"); } }) $(".back_topbtn").on("click",function(){ $('html,body').animate({scrolltop:0},300); }) } tme.fnbanner=function(){ $('.banner .owl-carousel').owlcarousel({ items: 1, margin: 0, autoplay: true, autoplaytimeout: 5000, autoplayhoverpause: true, // autoheight: true, loop:true, navigation : true, slidespeed : 300, paginationspeed : 400 }); } tme.fnnewsimg=function(){ $('.js_newsimg .owl-carousel').owlcarousel({ items: 1, margin: 10, autoheight: true }); } tme.fnnewstxt=function(){ $('.js_newstxt .owl-carousel').owlcarousel({ loop: true, margin: 10, responsiveclass: true, responsive: { 0: { items: 1, nav: true }, 420: { items: 1, nav: false }, 768: { items: 2, nav: false }, 992: { items: 2, nav: true, loop: true, margin: 20 } } }) } $(document).ready( tme.init ); $(document).ready(function() { jquery.jqtab = function(tabtit,tab_conbox,shijian) { $(tab_conbox).find(".list").hide(); $(tabtit).find("li:first").addclass("on").show(); $(tab_conbox).find(".list:first").show(); $(tabtit).find("li").bind(shijian,function(){ $(this).addclass("on").siblings("li").removeclass("on"); var activeindex = $(tabtit).find("li").index(this); $(tab_conbox).children().eq(activeindex).show().siblings().hide(); return false; }); }; /*调用方法如下:*/ $.jqtab(".section2_news .tit",".section2_news .cont","click"); });