Skip to content

Instantly share code, notes, and snippets.

@zzuhan
zzuhan / add-favorite.js
Last active October 13, 2018 01:28
javascript 点击按钮加入收藏夹.
/**
* - chrome为了安全考虑,设计的不支持js操作加入收藏夹,
* - 火狐23之后开始废止window.sidebar因为不是w3c标注 https://bugzilla.mozilla.org/show_bug.cgi?id=691647
* - document.all 判断IE不够靠谱,因为现在许多浏览器也实现了document.all吗,并且IE11以后(document.all)为falsy
* - 参考 http://stackoverflow.com/questions/10033215/add-to-favorites-button
* - IE 中typeof window.external.addFavorite 为'unknown' [http://www.xdarui.com/archives/203.html];
*/
var url = 'https://gist.github.com/',
title = 'gist代码片段';
@zhangolve
zhangolve / Full-Page-Background-Image.css
Last active November 18, 2024 15:38
响应式背景图片全屏实现css
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
//圆角
float2 UV = uvs;
float PixelRange = min(min(SizeX/2,SizeY/2),Range);
//当前绘制的像素
float2 CurrentP = float2(UV.x*SizeX,UV.y*SizeY);
//像素坐标参照点
//float2 MiddleP=float2(0.5*SizeX,0.5*SizeY);