Skip to content

Instantly share code, notes, and snippets.

View bh-lay's full-sized avatar
🏅
Github 认证工程师

剧中人 bh-lay

🏅
Github 认证工程师
View GitHub Profile
@bh-lay
bh-lay / stickyFooter.js
Last active August 29, 2015 14:13
stickyFooter
function stickyFooter($footer){
var $window = $(window);
//计算位置
function fix() {
$footer.css({
position: "static"
});
if ($window.height() < document.body.scrollHeight) {
$footer.css({
@bh-lay
bh-lay / each
Last active August 29, 2015 14:08
Traversal array or object
/**
* 遍历数组
*
*/
function each(arr,fn){
//检测输入的值
if(typeof(arr) == 'object' && typeof(fn) == 'function'){
var Length = arr.length;
if(Length && Length == +Length){
for(var i=0;i<Length;i++){
@bh-lay
bh-lay / isNum
Created October 30, 2014 06:09
check a variable is number include like number string
/**
* 检测是否为数字
* 兼容字符类数字 '23'
*/
function isNum(ipt){
return (ipt !== '') && (ipt == +ipt) ? true : false;
}
@bh-lay
bh-lay / TypeOf
Created October 30, 2014 06:04
get type of the variable
/**
* 判断对象类型
* string number array
* object function
* htmldocument
* undefined null
*/
function TypeOf(obj) {
return Object.prototype.toString.call(obj).match(/\s(\w+)/)[1].toLowerCase();
}