关于我的页面在加载的时候需要进行通过js进行判断进行启动背景的启动控制,特此备注
if (ClientName == "yigui") { if (ThisW > 768) { //在这里进行更新电脑端的背景 // console.log("dn"); } else { //在这里进行更新手机端的背景 document.body.style.background = "url('../../Image/Loading.gif') no-repeat center center"; document.body.style.backgroundSize = "auto 96%"; } }
通过jquery 可以进行直接更改样式
var ThisW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var ThisH = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
这个是直接获取页面的宽和高进行, 进行判断是否是手机和电脑的。然后进行判断是否进行修改,对不同的设备进行更改背景
var HKey = LoadUrlGetValues('HKey');
//获取参数 function LoadUrlGetValues(key) { var regs = new RegExp("(^|&)" + key + "=([^&]*)(&|$)"); var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)"); var result = window.location.search.substr(1).match(reg); return result ? decodeURIComponent(result[2]) : null; }