Skip to content

Instantly share code, notes, and snippets.

@icai
icai / tween
Created March 5, 2012 11:26
Tween function
var Tween = {
Linear:function (start,alter,curTime,dur) {return start+curTime/dur*alter;},//最简单的线性变化,即匀速运动
Quad:{//二次方缓动
easeIn:function (start,alter,curTime,dur) {
return start+Math.pow(curTime/dur,2)*alter;
},
easeOut:function (start,alter,curTime,dur) {
var progress =curTime/dur;
return start-(Math.pow(progress,2)-2*progress)*alter;
},
@icai
icai / add del event
Created March 5, 2012 11:27
addevent & delevent
function addEvent(obj,evt,fn) {
if (obj.addEventListener && !Browser.isOpera) {
obj.addEventListener(evt,fn,false);
return obj;
}
if (!obj.functions) obj.functions={};
if (!obj.functions[evt])
obj.functions[evt]=[];
@icai
icai / gist:1977941
Created March 5, 2012 11:29
addEventSimple & removeEventSimple
function addEventSimple(obj, evt, fn) {//常用函数
if (obj.addEventListener) // W3C
obj.addEventListener(evt, fn, false);
else if (obj.attachEvent) // Microsoft
obj.attachEvent('on' + evt, fn);
};
function removeEventSimple(obj, evt, fn) {
if (obj.removeEventListener)
@icai
icai / jquery-autoresize.js
Created June 11, 2012 09:08
jQuery autoResize (textarea auto-resizer)
/*
* jQuery autoResize (textarea auto-resizer)
* @copyright James Padolsey http://james.padolsey.com
* @version 1.04
*
* cracked by icyleaf <icyleaf.cn@gmail.com>
* Search and Find the keyword '[NEW ADDED]' for details.
*/
(function($){
@icai
icai / LICENSE.txt
Created June 20, 2013 15:43 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@icai
icai / accessibility
Created January 21, 2014 02:15
about accessibility
#accessibility
###Todo
- input,select,textarea,fieldset -> aria-labelledby="[id]"
- position element -> tabindex="-1"
- focusable -> tabindex="0"
- add `role` attribute
- add `aria-` attribute
@icai
icai / Highlight.css
Created January 28, 2014 16:11
Expressjs Highlight style
/* code */
p code {
background: #efefef;
border: 1px solid #eaeaea;
font-family: monaco, monospace;
font-size: .75em;
padding: 2px 8px;
-webkit-border-radius: 3px;
@icai
icai / html5doctor_ELEMENT_effect
Created April 4, 2014 05:44
html5doctor ELEMENT effect
var links = $("#glossary li a");
links.each(function() {
var linkWidth = $(this).outerWidth();
var canvas = $("<canvas></canvas>");
canvas.attr({width: linkWidth,height: 21});
var context = canvas.get(0).getContext("2d");
// Set up the rounded corners
context.lineWidth = 6;
@icai
icai / UI link
Created May 8, 2014 07:22
UI link
@icai
icai / UI link
Last active August 29, 2015 14:01
UI link