var Main = { top: function() { $("#m" + m).addClass("on"); Search.one("#TOPBTN", "TOPKEY", "", "关键词不能为空!", "输入的关键词字数不要过多!", "您输入的内容存在特殊字符!", searchpath) //判断是否有下拉 var _li=$("menu li") _li.each(function(){ var n=$(this).find("dd").length if(n>=1){ $(this).addClass("has-sub"); $(this).find('.quia').after(''); }else{ $(this).find('.qui-submenu').remove(); } //改变选中 鼠标经过去掉当前栏目选中 $(this).hover(function(){ $(this).addClass("on").siblings().removeClass("on"); },function(){ $(this).removeClass("on"); $("#m"+m).addClass("on"); }); }); $('.qui-top-nav .ULLIST>li .quiaa').click(function(event) { $(this).parents('li').toggleClass('wapon'); $(this).next('.quiwapnav').slideToggle('fast').parents('li').siblings('li').find('.quiwapnav').hide(); }); }, bottom: function() { Main.top(); //最大高度 $(".MAXBOX").each(function(i,item){ var maxheight = 0; for(var i = 0;i<$(this).find('.MAXLI').length;i++){ if(maxheight <= $(this).find('.MAXLI').eq(i).find('.MAXLI2').innerHeight()){ maxheight = $(this).find('.MAXLI').eq(i).find('.MAXLI2').innerHeight(); } } $(this).find('.MAXLI2').css('height',parseInt(maxheight)+'px'); }); //整站无图处理 setTimeout(function(){ $.each($("img"), function(i, n) { $(n).on('error', function() { n.src = nopicpath; }); n.src = n.src; }); $(".Ispic").each(function(){ var img=$(this).css("background-image") var nop='url("'+ location.protocol +'//'+ location.hostname +''+picpath+'")' if(img==nop){ $(this).css("background-image","url("+nopicpath+")") } }) },500) //返回顶部 $(window).scroll(function() { var stop = $(document).scrollTop() if (stop > 150) { $(".qui-gotop22").css('opacity', '1'); } else { $(".qui-gotop22").css('opacity', '0'); } }); $(".qui-gotop").click(function() { $('body,html').animate({ scrollTop: 0 }, 300) }); var LocalHref=encodeURIComponent(window.location.href); var WebTt = $('title').html(); //分享新浪微博 $(".qui-share-sina").attr("href","//service.weibo.com/share/share.php?url="+LocalHref+"&title="+ WebTt +'&searchPic=false'); //分享QQ $(".qui-share-qq").attr("href","//connect.qq.com/widget/shareqq/index.html?url="+LocalHref+"&title="+ WebTt); //tab切换 $(".qui-tab-box .qui-tab-ll").hide(); $(".qui-tab-box .qui-tab-tt .quia").each(function(i,item){ $(this).click(function(){ $(this).addClass("on").siblings().removeClass("on"); $(".qui-tab-box .qui-tab-ll").eq(i).stop().fadeIn('fast').siblings(".qui-tab-ll").hide(); }) }) $(".qui-tab-box").each(function(i,item){ $(this).find('.qui-tab-ll').eq(0).show(); $(this).find('.quia').eq(0).addClass("on"); }); }, keyword:function(){ var str=$("#keyword").text() var regExp = new RegExp(str, 'g'); $(".news-list .item").each(function(){ var html = $(this).find(".tit").html(); var newHtml = html.replace(regExp, "" + str + ''); //将找到的关键字替换,加上highlight属性; $(this).find(".tit").html(newHtml); //更新文章; }) }, } var Search = { one: function(btn, kid, txt, txt1, txt2, txt3, url) { $(btn).jqSearch({ TxtVal: txt, KeyTxt1: txt1, KeyTxt2: txt2, KeyTxt3: txt3, KeyId: kid, //输入框id KeyUrl: url, //跳转链接 KeyHref: "key", //链接传值 Static: false //是否静态站 }); } } //