Skip to content

Instantly share code, notes, and snippets.

View MingXingTeam's full-sized avatar

xing MingXingTeam

  • Hangzhou, China
View GitHub Profile
@MingXingTeam
MingXingTeam / customEvent.js
Created February 8, 2018 14:11
创建自定义事件
var customeEventImageLoad = document.createEvent('Event');
customeEventImageLoad.initEvent(myEventName, true, true);
on(window, myEventName, finalLazyLoadHandler, passiveEvent);
@MingXingTeam
MingXingTeam / testEventPassive.js
Last active February 8, 2018 14:55
判断事件是否支持passive
// Test via a getter in the options object to see
// if the passive property is accessed
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassive = true;
}
});
window.addEventListener("test", null, opts);
@MingXingTeam
MingXingTeam / throtte.js
Created February 8, 2018 06:51
函数节流
var module = {};
module.throttle = function (fn, threshhold, scope) {
threshhold || (threshhold = 250);
var last, deferTimer;
return function () {
var context = scope || this;
var now = +new Date,
args = arguments;
@MingXingTeam
MingXingTeam / introrx.md
Created February 4, 2016 15:54 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@MingXingTeam
MingXingTeam / proj_to_war.bat
Created January 19, 2016 01:31
自动将项目打包成war并上传到svn
@echo off
if exist "svn.config" goto start
echo failed to find svn.config at same directory
goto end
:start
set "file=svn.config"
for /f "usebackq tokens=1* delims=:" %%a in ("%file%") do (
set "%%a=%%b"
@MingXingTeam
MingXingTeam / loop.js
Last active January 16, 2016 09:13
循环执行代码 并且执行循环体每次传递的参数不同
// Code goes here
//loop obj
function rock(map,startCallBack,interval,isContinue,stopCallBack){
var param = (function getFirstKey(){
for(var key in map){
return key;
}
})();
function loop(){
@MingXingTeam
MingXingTeam / index.html
Last active January 10, 2016 14:27
图片替代方案(LOGO用图片代替)
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<h1 id="logo">
@MingXingTeam
MingXingTeam / index.html
Last active January 10, 2016 14:00
清除浮动的方法3
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div class="parent">
@MingXingTeam
MingXingTeam / index.html
Created January 10, 2016 13:48
清除浮动的方法2
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div class="parent">
@MingXingTeam
MingXingTeam / index.html
Created January 10, 2016 13:47
清除浮动的方法1
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div class="parent">