Skip to content

Instantly share code, notes, and snippets.

@willwei
willwei / jquery_tips.md
Last active December 27, 2015 03:59
jQuery tips

##jQuery对象与DOM对象
//以下都返回了DOM对象 $("#msg")[0],$("div").eq(1)[0],$("div").get()[1],$("td")[5] //eq表示获取jquery元素;get表示获取dom元素 ##jQuery Ready $(document).ready(function(){ alert('Welcome to StarTrackr! Now no longer under police investigation!'); }); $(function() { alert('Ready to do your bidding!'); }); ##Toggling Elements

@willwei
willwei / ie678.md
Last active December 27, 2015 10:48
javascript 判断IE6/7/8

#无框架支持 var isIE = !! window.ActiveXObject; var isIE6 = isIE && !window.XMLHttpRequest; var isIE8 = isIE && !! document.documentMode && (document.documentMode == 8); var isIE7 = isIE && !isIE6 && !isIE8;

@willwei
willwei / zindex.md
Last active December 28, 2015 18:09
今天遇到了个z-index的问题,做下笔记吧。

#问题描述: ##环境 IE全家 ##具体描述 <!doctype html> <title>normal mode</title>

@willwei
willwei / kissy_oop.js
Created December 5, 2013 08:23
KISSY OOP 组件编写
/**
* [Con_fun description]
* @param {[type]} container [description]
* @param {[type]} config [description]
* 继承关系
*/
function Con_fun(container,config){
var self = this;
if (!(this instanceof Con_fun)){
@willwei
willwei / ieGradientOpactiy.md
Last active January 2, 2016 19:09
IE下使用filter实现纯色背景半透明

IE滤镜采用AARRGGBB(16进制)进行排列,AA位值也为 00-FF,也就是说10进制需要转成16进制 计算规则 10进制值*256/100然后再转16进制,就是说如果设置0.4的透明度40*256/100 = 102.4转16进制为66

  .rgba .test{ 
    background:rgba(255,255,255,.4); 
    background:none\9; 
    filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr=#66FFFFFF,endColorStr=#66FFFFFF);
  }
@willwei
willwei / position.md
Last active January 2, 2016 19:19
position:absolute

s

@willwei
willwei / function.md
Created January 23, 2014 08:23
我们将详细讲解一下各种类型的函数是如何影响上下文的变量对象以及每个函数的作用域链都包含什么。

#EcmaScript function ##概要 In this article we will talk about one of the general ECMAScript objects — about functions. In particular, we will go through various types of functions, will define how each type influences variables object of a context and what is contained in the scope chain of each function. We will answer the frequently asked questions such as: “is there any difference (and if there are, what are they?) between functions created as follows:
在这一章节中,我们来探讨下ECMAScript中一个很重要的对象-函数。我们将详细讲解一下各种类型的函数是如何影响上下文的变量对象以及每个函数的作用域链都包含什么,我们将回答诸如像下面这样的问题:下面声明的函数有什么区别么?(如果有,区别是什么)。

var foo = function () {
  ...
};

from functions defined in a “habitual” way?:

#蘑菇街面试经历 ##DOCTYPE类型以及区别 ##CSS性能优化 ##float ##清楚浮动的方法 ##display:none和visibility:hidden ##animate 动画队列,如何解决callback中调用callback ##KISSY 框架 ##JSONP为什么能够跨域

@willwei
willwei / jsonp.md
Last active August 29, 2015 13:56
JSONP

利用Script标签可以跨域请求
返回的script中:my_callback({['some string 1', 'some data', 'whatever data']});
已定义好的函数:my_callback(){}

@willwei
willwei / snow
Created December 17, 2014 13:43
function k(a, b, c) {
if (a.addEventListener) a.addEventListener(b, c, false);
else a.attachEvent && a.attachEvent("on" + b, c)
}
function g(a) {
if (typeof window.onload != "function") window.onload = a;
else {
var b = window.onload;
window.onload = function() {