Skip to content

Instantly share code, notes, and snippets.

View alanerzhao's full-sized avatar
🎯
Focusing

螃蟹 alanerzhao

🎯
Focusing
View GitHub Profile
var pullrefresh = {
/*++++++++++++++ 初始化 +++++++++++++*/
init: function (data) {
var self = this;
this.generatedCount = 0;
document.addEventListener('DOMContentLoaded', function () {
setTimeout(function () {
function upDownShow (currObj,showObj) {
var top = currObj.offset().top,
height = showObj.height(),
curHeight =currObj.height();
winTop = $(window).scrollTop();
if(top-winTop < height) {
showObj.css({"top":curHeight}).show();
} else {
showObj.css({"top":-height})
}
@alanerzhao
alanerzhao / 判断.js
Created January 2, 2014 04:53
判断
/*
test 检查指定的字符串是否存在
exec 返回查询值
match 得到查询数组
search 返回搜索位置
replace 替换字符 利用正则替换
split 利用正则分割数组
*/
var str = "Str",
num = 1123,
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
/*
* From css-tricks.com
* http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/*
test 检查指定的字符串是否存在
exec 返回查询值
match 得到查询数组
search 返回搜索位置
replace 替换字符 利用正则替换
split 利用正则分割数组
*/
var str = "Str",
num = 1123,
@alanerzhao
alanerzhao / tag.js
Created November 26, 2013 11:02
标签选择
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
body{
font-size:12px;
}
.hover{
var processor = {
timeoutId : null,
performProcessing : function () {
},
process: function () {
clearTimeout(this.timeoutId);
var that = this;
this.timeoutId = setTimeout(function () {
that.performProcessing();
},100)
//array chunking
function chunk (array,process,context) {
setTimeout(function () {
//取出数组每一项
var item = array.shift();
//处理函数
process.call(context,item);
//只要不为空
if(array.length > 0) {
setTimeout(arguments.callee,100);