- 例1(小米米官网):font: 14px/1.5 "Helvetica Neue",Helvetica,Arial,"Microsoft Yahei","Hiragino Sans GB","Heiti SC","WenQuanYi Micro Hei",sans-serif;
- 例2(淘宝技术研发中心):font: 12px/1.5 tahoma,arial,'Hiragino Sans GB','\5b8b\4f53',sans-serif;
- 例3(加网 ):font: 14px/1.5 'Microsoft YaHei',arial,tahoma,\5b8b\4f53,sans-serif;
- 例4(淘宝UED):font: 12px/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif;
- 例5(一淘UX):font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;
- 例6(简书):font-family: "lucida grande", "lucida sans unicode", lucida, helvetica, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
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
/* This function will convert each color to gray scale and return average of all pixels, so final value will be between 0 (darkest) and 255 (brightest) */ | |
function getImageLightness(imageSrc,callback) { | |
var img = document.createElement("img"); | |
img.src = imageSrc; | |
img.style.display = "none"; | |
document.body.appendChild(img); | |
var colorSum = 0; | |
img.onload = function() { |
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
const deepMerge = (target = {}, origin = {}) => { | |
const toString = Object.prototype.toString; | |
for (let prop in origin) { | |
let originProp = origin[prop], | |
targetProp = target[prop]; | |
if (typeof originProp === 'object') { | |
if (toString.call(originProp) === '[object Object]') { | |
target[prop] = {}; |
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
// 元素的偏移量 只读属性 | |
// 包含了元素在屏幕上占的所有可用空间 由元素的大小来决定 包括内边距边框和滚动条 | |
// !!! 不包括外边距 | |
// 元素的offsetTop和offsetLeft属性是到上级包含它的元素的距离 | |
// 计算元素在页面上的偏移量 将偏移量循环到根元素即可得到 | |
function getOffsetPos (element) { | |
var offsetTop = element.offsetTop, | |
offsetLeft = element.offsetLeft; |
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
// 背景色 | |
background: linear-gradient(45deg,#00ae7b,#0081bf); // 蓝绿色渐变 | |
/* 文字 */ | |
// 黄色 | |
background-image: linear-gradient(to bottom, #fffffd 15%, #ffff0b 60%); |
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
<meta name="twitter:card" content="summary_large_image"> | |
<meta name="twitter:site" content="@ntnyq"> | |
<meta name="twitter:title" content=""> | |
<meta name="twitter:description" content=""> | |
<meta name="twitter:image" content=""> | |
<meta property="og:image" content="" itemprop="thumbnailUrl"> | |
<meta property="og:title" content=""> | |
<meta property="og:url" content=""> | |
<meta property="og:site_name" content=""> | |
<meta property="og:description" 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
var ntnyq = function () { | |
function Goy () {} | |
Goy.fn = Goy.prototype; | |
return new Goy(); | |
}(); |
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 ($) { | |
var $backToTop = $('#back-to-top'); | |
$(window).scroll(function(e) { | |
if ($(window).scrollTop() >= 100) { | |
$backToTop.fadeIn(300); | |
} else { | |
$backToTop.fadeOut(300); | |
} | |
}); | |
$backToTop.click(function(e) { |
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 EventEmiter = function (){ | |
this._events = {}; | |
}; | |
EventEmiter.prototype.on = function (event, cb){ | |
if (Array.isArray(event)){ | |
for (let i = 0, l = event.length; i < l; i++){ | |
this.on(event[i], cb); | |
} | |
} else { |
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
const files = require.context('.', true, /models\/[^/]+\.js$/) | |
files.keys().forEach(key => { | |
module.exports[key.replace(/\.\/models\/|\.js/g, '')] = files(key).default | |
}) |
OlderNewer