Skip to content

Instantly share code, notes, and snippets.

@lgmcolin
lgmcolin / gist:7799011
Last active December 30, 2015 07:49
用translate3d实现input拉长 效果:http://jsbin.com/uqODOPi/1/edit
<style>
body {
margin: 100px;
}
.clipped {
position: relative;
width: 154px;
}
@lgmcolin
lgmcolin / gist:7838680
Last active December 30, 2015 13:59
写了个自定义transition,并且实现transition运行结束后触发callback. 效果: http://jsbin.com/ezAFaVIJ/1/edit
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<title>test</title>
<style>
body{
margin:20px;
}
.element{
@lgmcolin
lgmcolin / my reset
Created December 25, 2013 09:59
Reset CSS,Essentially Eric Meyer's reset( http://meyerweb.com/eric/tools/css/reset/ ), I've made a few tweaks that make his reset more palatable to my tastes.
/* 浏览器样式重置
----------------------------------*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,menu{
margin:0;
padding:0;
}
article,aside,dialog,footer,header,section,footer,nav,figure,menu{
display:block;
}
table{
@lgmcolin
lgmcolin / reversal
Created December 25, 2013 10:03
css3 transform实现简单翻转
/**
part of html
<div id="box">
<div id="preserve-box">
<div class="front">我是正面</div>
<div class="bottom">我是反面</div>
</div>
</div>
**/
@lgmcolin
lgmcolin / collector_1
Last active January 1, 2016 12:29
页面代码片段mark
/**
* 1. 清除浮动
* 2. 固定Footer在页面底部的跨浏览器解决方案(2种方法实现)
* 3. css透明度opacity
* 4. @font-face语法
* 5. 浏览器hack
* 6. PNG32透明(IE6)
* 7. 让IE9以下的版本支持HTML5
* 8. 文本溢出省略
* 9. 线性渐变(兼容)
@lgmcolin
lgmcolin / phoneCollector_1
Last active January 1, 2016 12:29
移动端代码片段mark
/*
* 1. media query
* 2. meta标签
* 3. link标签
* 4. retina解决方案
* 5. 判断手机或平板
* 6. 关闭自动大写与自动修正
* 7. 被点击元素外观变化,可以通过样式来设定
* 8. 阻止旋转屏幕是自动调整字体大小
**/
@lgmcolin
lgmcolin / es5_Array
Created January 16, 2014 07:37
ECMAScript array method,兼容ie6-8
/**
* ES5中新增数组方法的兼容实现
* method:// forEach map filter some every indexof lastindexof reduce reduceRight
*/
if(typeof Array.prototype.forEach != 'function'){
Array.prototype.forEach = function(fn,context){
if(typeof fn === 'function'){
for(var i = 0,length = this.length; i<length; i++){
fn.call(context,this[i],i,this);
}
@lgmcolin
lgmcolin / node_dirCopy
Created January 17, 2014 08:01
node 简单文件复制
var fs = require('fs'),
path = require('path');
exports.merge = function(src,des,cb){
if(!cb) cb = function(){}
var src = path.resolve(src),
des = path.resolve(des);
if(src.indexOf(des)){
return cb(new Error('error'));
@lgmcolin
lgmcolin / jq-goTop
Created January 19, 2014 02:14
jquery Go-top插件
(function($){
$.GoToTop = {
defaults: {
autoShow : true,
timeEffect : 500,
effectScroll : 'linear',
appearMethod : 'slide'
},
@lgmcolin
lgmcolin / merge-descripe
Last active August 29, 2015 13:57
merge-descripe简单实现属性继承 from: https://github.com/component/merge-descriptors
module.exports = function (dest, src) {
Object.getOwnPropertyNames(src).forEach(function (name) {
var descriptor = Object.getOwnPropertyDescriptor(src, name)
Object.defineProperty(dest, name, descriptor)
})
return dest
}
// called