var istouch = modernizr.touchevents, ismobile = false, w_width = jquery(window).width(), w_height = jquery(window).height(), $mtop = jquery(".mtop"), $mtoph = $mtop.height(); var menu = { trigger: ".menu-handler", init: function () { menu.bind(); }, bind: function () { $(document).on("click", menu.trigger, menu.open); $(document).on("click", ".navmobile dd p a", function (e) { var menucur = $(this); var menudd = $(this).parents("p").parents("dd"); if (menudd.find(".msubnav").size() > 0) { if (menucur.hasclass("cur")) { menudd.find(".msubnav").stop(false, false).slideup(); menucur.removeclass("cur"); } else { jquery(".navmobile dd p a").removeclass("cur"); jquery(".msubnav").stop(false, false).slideup(); menudd.find(".msubnav").stop(false, false).slidedown(); menucur.addclass("cur"); e.preventdefault(); } } }); $(document).on("click", "#bg-menu", menu.open) }, open: function () { if ($("body").is(".open")) { $("body").removeclass("open"); $(".menu-handler").removeclass("active"); $("#bg-menu").fadeto("fast", 0, function () { $("#bg-menu").hide(); }); } else { $("#bg-menu").fadeto("fast", 0.4); $("body").addclass("open"); $(".menu-handler").addclass("active"); } } }; var _mousemove; var _click; var _mousedown; var _mouseup; if (modernizr.touchevents) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pagebox() { w_width = jquery(window).width(); w_height = jquery(window).height(); if (w_width <= 1024) { ismobile = true; } else if (w_width > 1024) { ismobile = false; jquery('.pbanner .pimg').css('transform', "translate(0px,0px)"); }; $mtoph = $mtop.height(); }; function setimgmax(img, imgw, imgh, tw, th) { var twidth = tw || w_width; var theight = th || w_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; }; pagebox(); jquery(window).resize(function () { pagebox(); }); window.onload = function () { $('.loadingbg').fadeout(); if (jquery(".teamibox").length >= 1) { jquery(".teamibox dd.item a").height(jquery(".teamibox dd.item2 img").innerheight()); jquery(".teamibox dd.item1 a").height(jquery(".teamibox dd.item2 img").innerheight() * 2); } } $(".searchtxt").keyup(function (event) { var keyvalue = event.which; var vakes = $(this).val(); if (keyvalue == 13) { if (vakes == '') { $(this).focus(); return; } window.location = 'search.aspx?keyword=' + encodeuricomponent(vakes); } }) $('.searchbtn').click(function () { var vakes = $(".searchtxt").val(); if (vakes == '') { $(".searchtxt").focus(); return; } window.location = 'search.aspx?keyword=' + encodeuricomponent(vakes); }); //点赞 var isajax2 = true; function praise(id, obj) { var isajx = jquery(obj).attr("isajx"); if (isajax2 && isajx == "0") { jquery.ajax({ type: "post", url: "tools/updatehite.ashx?t=" + math.random(), data: { action: "updatehite", id: id }, datatype: "html", cache: true, beforesend: function () { isajax2 = false; }, success: function (data) { var num = jquery(obj); if (data == "true") { num.html(number(num.html()) + 1).addclass("red"); jquery(obj).attr("isajx", "1"); } else alert('抱歉,提交失败'); isajax2 = true; }, error: function () { alert("请求错误"); isajax2 = true; } }) } else { alert('亲,你已经点赞过了 不要重复咯'); } } jquery(function () { menu.init(); jquery(".gropbox .searchtxt").focus(function () { jquery(this).stop(false, false).animate({ width: "130" }, 300); }); jquery(".gropbox .searchtxt").blur(function () { jquery(this).stop(false, false).animate({ width: "100" }, 300); }); setpopup(jquery(".tool .a4"), "官方微信"); setpopup(jquery(".weixin"), "官方微信"); function setpopup(obj, title) { obj.click(function () { var str = '