1.美化checkbox和radio
icheck
虽然看github上这个项目已经一年没更新了,但是样式还是不错的,就拿来用了。
2.switch在作对比时用的是全等运算。
3.javascript中实现继承的方法
1)通过prototype实现
2)通过Object.create()实现
3)es6方法,通过class实现
3.动态加载script标签,加载完成事件
var script= document.createElement("script");
document.head.appendChild(script);
script.onload = scriptLoaded;
script.onreadystatechange = scriptLoaded;
script.src = "script.js";
function scriptLoaded() {
if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") {
script.onload = script.onreadystatechange = null;
console.log("loaded");
}
}
4.drop-shadow和box-shadow的区别
drop-shadow的优点:是真正的阴影,box-shadow只是矩形盒子阴影
box-shadow的优点:
1)兼容性好;
2)支持内阴影;
3)支持多重阴影;
5.loading动画图标
preloaders.net
loading.io
6.去除input number的上下箭头
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button{
-webkit-appearance: none !important;
margin: 0;
}
input[type="number"]{-moz-appearance:textfield;}
7.在微信开发中,video标签要放在全局滚动中。
8.移动端rem解决方案。链接
9.Safari浏览器Date对象解析bug
要把日期中的-替换成/,Safari才能正确解析
链接