Skip to content

Instantly share code, notes, and snippets.

View qzm's full-sized avatar
🚀
I may be slow to respond.

Aaron Qiu qzm

🚀
I may be slow to respond.
View GitHub Profile
@qzm
qzm / requestAnimationFrame.js
Last active April 27, 2016 11:31
requestAnimationFrame and cancelAnimationFrame
// requestAnimationFrame
window.requestAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
setTimeout(callback, 1000 / 60);
};
@qzm
qzm / popup.html
Created December 8, 2016 14:29
带三角形的popup
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.popup {
@qzm
qzm / gpu.css
Created December 8, 2016 14:35
开启浏览器的GPU加速
.calssName {
transform: translateZ(0);
}
.className {
transform: translate3d(0, 0, 0);
}
@qzm
qzm / rotate.css
Last active December 8, 2016 14:42
CD旋转样式
.box {
width: 100px;
height: 100px;
border: 1px #111 solid;
position: relative;
transition: background-color 1s ease;
transition: width 1s ease;
animation-name: mymove;
animation-duration: 3s;
animation-timing-function: linear;
@qzm
qzm / triangl.css
Created December 8, 2016 14:50
CSS三角形
.triangl {
/* 设置div的高度和宽度为 0 ,使得整个box只有border的部分 */
height: 0;
width: 0;
/* 设置border为需要的宽度,并隐藏其他三边,这样三角形就出来了 */
border-width: 15px;
border-style: solid;
border-color: transparent transparent #CCC transparent;
}
@qzm
qzm / bootstrap3-media-query.css
Last active December 28, 2016 04:04 — forked from redfrost/Media Query
Bootstrap3 Media Query
/* Desktop */
@media (min-width: 1601px) { }
/* Laptop */
@media (min-width: 1200px) { }
/* Tablet Horizontal */
@media (min-width: 992px) and (max-width: 1199px) { }
/* Tablet Vertical */
@qzm
qzm / auto-square.css
Created March 2, 2017 09:31
自适应正方形
/* 方法一:1个vw 单位,代表1%视窗单位,相对的还有 hv ,代表一个视窗高度 */
.square {
width : 25%;
height : 25vw;
}
/* 方法二:height 为0,使用padding撑开高度,padding的百分比根据所在block的宽度来计算的 */
.square {
width : 25%;
height : 0;
@qzm
qzm / horizontally.css
Last active March 2, 2017 09:47
CSS垂直居中
/* 方法一:使用table-cell 垂直居中*/
.fatherNode {
display : table-cell;
}
.childNode {
vertical-align : middle;
}
/* 方法二:设置top为50%,top的定位为负数的1/2高度 */
.className {
@qzm
qzm / 3.js
Created March 10, 2017 07:48
正则表达式,三位数字加逗号
replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,'$1,');
@qzm
qzm / clearfix.css
Last active March 20, 2017 15:34 — forked from red2678/clearfix.css
ClearFix
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {