This file contains 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.addEventListener('scroll', function (e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
document.documentElement.scrollTop = 0; | |
}); |
This file contains 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 () { | |
String.prototype.padStart = String.prototype.padStart || function padStart (targetLength, content) { | |
content = String(content) | |
if (this.length >= targetLength) { | |
return this | |
} | |
var needLength = targetLength - this.length; | |
var needStr = content; |
This file contains 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 () { | |
function _bind(context) { | |
var fn = this; | |
var _this = context; | |
var bindArgs = Array.prototype.slice.call(arguments, 1); | |
return function () { | |
var args = Array.prototype.slice.call(arguments); | |
args = bindArgs.concat(args); | |
return fn.apply(_this, args); | |
} |
This file contains 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
/* 使用 clipboard.js 库 */ |
This file contains 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
var MyApp = {}; | |
MyApp.namespace = function (name) { | |
var parts = name.split('.'); | |
var current = MyApp; | |
for (var i in parts) { | |
if ( !current[ parts[i] ] ) { | |
current[ parts[i] ] = {}; | |
} | |
current = current[ parts[i] ]; |
This file contains 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、CSS禁止选择文字,针对IE、FF、Chrome等 | |
<div unselectable="on" style="-moz-user-select:none;-webkit-user-select:none;" onselectstart="return false;"> | |
你选不了我, | |
unselectable: IE/Opera, | |
-moz-user-select: FireFox, | |
onselectstart: IE/Safari, | |
-webkit-user-select:Chrome | |
</div> |
This file contains 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
<!doctype html> | |
<html lang="zh"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>绝对定位实现自适应与居中</title> | |
<style> | |
#box { | |
position: absolute; | |
top: 8px; | |
right: 8px; |