//字体变换 var bodywidth = document.body.clientwidth; document.getelementsbytagname("html")[0].style.fontsize = bodywidth / 10 + "px"; //手机导航 $(".btn").click(function () { if ($(this).hasclass("cross")) { $(this).removeclass("cross"); $(".wrapper") .css({ "overflow-x": "hidden" }) .animate({ left: "0" }); $(".m-nav").animate({ right: "-150px", width: "0" }); $(".m-top").animate({ left: "0" }); } else { $(this).addclass("cross"); $(".wrapper") .css({ "overflow-x": "visible" }) .animate({ left: "-150px" }); $(".m-nav").animate({ right: "0", width: "150px" }); $(".m-top").animate({ left: "0" }); } });