$(function(){ //搜索输入框内无信息提示 $(".search-submit").click(function(event) { $(this).removeAttr("name"); /* Act on the event */ event.preventDefault(); var val = $.trim($(".search-title").val()); if(val!==""){ $(".search-window").find("form").submit(); }else{ alert("请输入关键词.."); } return false; }); //搜索输入框滑出前总宽度 $("body,html").click(function(){ $(".search-window").animate({"width":"40px"}); $(".searchbtn").stop(true,true).fadeIn(); $(".navlist").slideUp(); }); //搜索输入框滑出效果及滑出后总宽度 $(".searchbtn").click(function(){ $(this).stop(true,true).fadeOut(); $(".search-window").stop(true,true).animate({"width":"240px"}); return false; }); $(".search-title").click(function(){ return false; }); //修改搜索输入区域背景色 /* $(document).ready(function(){ $(".search-input input").focus(function(){ $(".search-input input").css("background-color","#fff"); }); $(".search-input input").blur(function(){ $(".search-input input").css("background-color","#fff"); }); }); */ //二维码淡入淡出效果 $(".shares li").each(function(){ $(this).children("a").hover(function(){ $(this).parent().find(".con").stop(true,true).fadeIn(); },function(){ $(this).parent().find(".con").stop(true,true).fadeOut(); }); }); //友情链接滑出效果 $(".botlinks .links-wrap .links-box").each(function(index, el) { $(el).hover(function() { $(this).addClass('wrap-open').children('.link-items').stop(true,true).slideDown(300); }, function() { $(this).removeClass('wrap-open').children('.link-items').stop(true,true).slideUp(300); }); }); //上传的文档图标不居中显示 if($(".wp_articlecontent").length > 0 ){ $(".wp_articlecontent img").each(function(){ var imgUrl = $(this).attr("src"); if(/_ueditor/.test(imgUrl)){ $(this).css("display","inline"); } }); } //导航置顶随页面移动 if($(window).width()> 767){ window.onscroll = function(){ var zhead = $(".header").height() + 5; //获取头部高度 var sTop = $(document).scrollTop(); //滚动事件 if( parseInt(sTop) > zhead){ //触发条件,可使用数字 $('.navi').addClass('roll'); }else { $('.navi').removeClass('roll'); } if( parseInt(sTop) > zhead){ //触发条件,显示返回顶部按钮,可使用数字 $(".goTop").show(); }else { $(".goTop").fadeOut(800); } $(".goTop").on("click",function(){ //滚动速度 $("body,html").stop().animate({scrollTop:0}, 800); }); if(window.screen.width <= 768){ //判断分辨率 $(".goTop").remove(); } } } });