2018 .8.11’遇到的问题

bg图片遮罩,用before记得用position:relative;
用overflow时zoom:1 会挡住,这时候可以不用float:left 可以选择display:inline-block 或者用flex布局
做pc端一般常用margin:0 auto; max-width:1920px;min-width:1200px
Math.random用setInter改变元素,不要写在括号里,页面或重渲染,这时候会一直随机
css3动画可以在调试最后的css查看。

jq实现异步操作方式,// async: false,页面会堵塞。使用同步等待请求回来再进行其他操作,卡死,不过可以防止浏览器拦截,解决办法,不同步,继续异步打开一个窗口,再操作窗口

function name() {
let defer = $.Deferred();
$.ajax({
url: `${$this.$HOST_NAME}/games/login`,
timeout:2000,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: `${localStorage.token}`
},
// async: false,
type: "post",
data: {
gameName: datas.gameName,
userType: "0",
platform: datas.platform
},
success: res => {
if (res && res.code == 200) {
defer.resolve(res.data)
} else {
alert(res.message);
}
}
});
return defer.promise();
}

$.when(name()).done(function(res){
console.log(res)
window.open(
res.url,
"newwindow",
"height=750,width=1285, top=0, left=" +
(window.screen.availWidth - 1295) / 2 +
""
);
 
});

猜你喜欢

转载自www.cnblogs.com/cainiao-vcu/p/9458512.html