$(function () { //主菜单 // $(".menu li[key='0']").addclass("menucurrent"); $(".menu li").hover(function () { $(this).children("ul").css("display", "block"); }, function () { $(this).children("ul").css("display", "none"); }); $(".menu li[key='6']").click(function () { $.cookie("news", null); }); $("#headnew1").click(function (event) { $.cookie("news", "new1"); event.stoppropagation(); }); $("#headnew2").click(function (event) { $.cookie("news", "new2"); event.stoppropagation(); }); $("#headnew3").click(function (event) { $.cookie("news", "new3"); event.stoppropagation(); }); $("#headnew4").click(function (event) { $.cookie("news", "new4"); event.stoppropagation(); }); $("#headnew5").click(function (event) { $.cookie("news", "new5"); event.stoppropagation(); }); $("#headnew6").click(function (event) { $.cookie("news", "new6"); event.stoppropagation(); }); /* 右侧浮动导航 */ $(window).scroll(function () { nowtop = parseint($(window).scrolltop()); $('#daohang').css('top', nowtop + 100 + 'px') }) $("#backtop").click(function () { $('body,html').animate({ scrolltop: 0 }, 1000); return false; }); $("#mobile").hover(function () { $("#mobile").children(".mobile").show(); }, function () { $("#mobile").children(".mobile").hide(); }); /* 产品搜索框焦点 */ $(".pdinput").focus(function () { if ($(".pdinput").val().replace(/^\s+|\s+$/g, '') == '请输入产品名称') { $(".pdinput").val(''); } }); $(".pdinput").blur(function () { if ($(".pdinput").val().replace(/^\s+|\s+$/g, '') == '') { $(".pdinput").val('请输入产品名称'); } }); }) function ztcookie(zt) { $.cookie("ztcookie", zt); }