$(function() { //搜索获取和失去焦点 var q = $("#q"); q.focus(function(){ $(this).parent().addClass("focus"); }); q.blur(function(){ $(this).parent().removeClass("focus"); }); //导航菜单 if ($.support.msie && $.support.version.substr(0,1) < 7){ $('#menu li').has('ul').mouseover(function(){ $(this).children('ul').css('visibility','visible'); }).mouseout(function(){ $(this).children('ul').css('visibility','hidden'); }); } $('.menu2 li').hover( function () { $(this).focus().addClass('focus'); }, function () { $(this).focus().removeClass('focus'); } ); /*.mouseover(function(){ $(this).focus().addClass('focus').siblings().removeClass('focus'); }).mouseout(function(){ $(this).focus().removeClass('focus'); });*/ //菜单滚动 var timmer = null; $(window).scroll( function() { var d = $(document).scrollTop(), e = $(window).height(); 136 < d ? $('#topbg').addClass('navbar-fixed-top') : $('#topbg').removeClass('navbar-fixed-top'); clearTimeout(timmer); timmer = setTimeout(function() { clearTimeout(timmer) },100); } ); //logo $(".logo").hover( function () { $(this).find('span').show(); }, function () { $(this).find('span').hide(); } ); //微博 $("#weibo").hover( function () { $(this).find('div').show(); }, function () { $(this).find('div').hide(); } ); //移动端 $("#yidong").hover( function () { $(this).find('div').show(); }, function () { $(this).find('div').hide(); } ); //微信公众号 $("#weixin").hover( function () { $(this).find('div').show(); }, function () { $(this).find('div').hide(); } ); //工程案例大图 $("#case-big").hover( function () { $(this).find('span').show("slow"); }, function () { $(this).find('span').hide("slow"); } ); //新闻与日期 $('.order_nav .not_ie').hover(function () { $(this).addClass('on'); }, function () { $(this).removeClass('on'); }); //栏目展开菜单 $(".sideMenu").slide({ titCell:"h3", //鼠标触发对象 targetCell:"ul", //与titCell一一对应,第n个titCell控制第n个targetCell的显示隐藏 effect:"slideDown", //targetCell下拉效果 delayTime:300 , //效果时间 triggerTime:150, //鼠标延迟触发时间(默认150) defaultPlay:false,//默认是否执行效果(默认true) returnDefault:false //鼠标从.sideMen移走后返回默认状态(默认false) }); //循环内容中的图像获取宽度、指定链接 $("#content").find('img').each(function(i){ $(this).removeAttr("style").removeAttr("width").removeAttr("height"); $(this).addClass("img-responsive center-block"); }); //循环文章内容中的图像获取宽度、指定链接 $("#article").find('img').each(function(i){ var strA = ""; $(this).wrapAll(strA); $(this).removeAttr("style").removeAttr("width").removeAttr("height"); $(this).addClass("img-responsive center-block"); }); $("#ecommerce").find('img').each(function(i){ $(this).removeAttr("style").removeAttr("width").removeAttr("height"); $(this).addClass("img-responsive center-block"); }); //追加下载地址样式 $("#softlinks").find('a').addClass('btn btn-success'); //客服代码 $("#floatTools").hover( function () { $('#divFloatToolsView').animate({width:'show',opacity:'show'},100,function(){$('#divFloatToolsView').show();}); $('#aFloatTools_Show').hide(); $('#aFloatTools_Hide').show(); }, function () { $('#divFloatToolsView').animate({width:'hide', opacity:'hide'},100,function(){$('#divFloatToolsView').hide();}); $('#aFloatTools_Show').show(); $('#aFloatTools_Hide').hide(); } ); //产品中心二级栏目图片切换 $(".sideimg").hover( function () { $(this).find('span').show(); }, function () { $(this).find('span').hide(); } ); //获取工程案例数量 /* var totleNum = $(".pageinfo").find('strong').eq(1).html(); if(typeof(totleNum)!='undefined') { $("#totleNum").append(totleNum); } else { $("#totleNum").append('0'); }*/ //判断访问终端 var browser={ versions:function(){ var u = navigator.userAgent, app = navigator.appVersion; return { trident: u.indexOf('Trident') > -1, //IE内核 presto: u.indexOf('Presto') > -1, //opera内核 webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核 mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端 iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器 iPad: u.indexOf('iPad') > -1, //是否iPad webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部 weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增) qq: u.match(/\sQQ/i) == " qq" //是否QQ }; }(), language:(navigator.browserLanguage || navigator.language).toLowerCase() } //判断是否移动端 if(browser.versions.mobile||browser.versions.android||browser.versions.ios){ //循环数组分别获取宽度 //var res = $('#content'); //res.find('img').each(function(i){ // $(this).removeAttr('style').removeAttr('width').removeAttr('height').addClass('img-responsive center-block'); //}); //res.find('table').each(function(i){ // $(this).removeAttr('style').removeAttr('width').removeAttr('height').addClass('table table-bordered'); //}); //追加按钮btn-block $('#btn-block').addClass('btn-block btn-lg'); } }); //收藏本站 function AddFavorite(title, url) { try { window.external.addFavorite(url, title); } catch (e) { try { window.sidebar.addPanel(title, url, ""); } catch (e) { alert("抱歉,您所使用的浏览器不支持收藏功能。\n\n您可以通过快捷键 ctrl+D 加入到收藏夹"); } } } // Copyright 2014-2015 Twitter, Inc. // Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) if (navigator.userAgent.match(/IEMobile\/10\.0/)) { var msViewportStyle = document.createElement('style') msViewportStyle.appendChild( document.createTextNode( '@-ms-viewport{width:auto!important}' ) ) document.querySelector('head').appendChild(msViewportStyle) }