A circular date picker with pure CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 得到元素相对于document的offset | |
* @param {Element} ele | |
* @return {object} | |
*/ | |
function getOffset(ele) { | |
var box = {top: 0, left: 0}; | |
var doc = ele.ownerDocument; | |
var docElem = doc.documentElement; | |
var win = doc.defaultView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @description 在指定的数字前补0 | |
* | |
* @num 要补0的数字 | |
* @length 补0之后的总长度 | |
* | |
* @return 补0之后的结果 | |
*/ | |
function padding(num, length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax*/ | |
@font-face { | |
font-family: 'Web Font'; | |
src: url('AlexBrush-Regular.eot?#iefix') format('embedded-opentype'), /*IE*/ | |
url('AlexBrush-Regular.woff') format('woff'), /*Chrome, Firefox, Opera, Safari*/ | |
url('AlexBrush-Regular.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ | |
url('AlexBrush-Regular.svg#svgFontName') format('svg'); /*iOS 4.1-*/ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2010, KISSY UI Library v1.0.8 | |
MIT Licensed | |
build: 871 Jul 19 08:51 | |
*/ | |
/* | |
KISSY CSS Reset | |
理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。 | |
2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。 | |
3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/a/11381730/989439 | |
function mobilecheck() { | |
var check = false; | |
(function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>文字在定高容器中垂直居中</title> | |
</head> | |
<body> | |
<div class="main"> | |
<span class="valign-text">我应该是垂直居中的我应该是垂直居中的我应该是垂直居中的我应该是垂直居中的我应该是垂直居中的我应该是垂直居中的</span><i class="valign-helper"></i> | |
</div> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function selectFrom(lowerValue, upperValue) { | |
var choices = upperValue - lowerValue + 1; | |
return Math.floor(Math.random() * choices + lowerValue); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get the global var in both browser and node etc. | |
//reference: http://stackoverflow.com/questions/3277182/how-to-get-the-global-object-in-javascript | |
var Fn = Function, global = Fn('return this')(); |
NewerOlder