Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

ryanlid ryanlid

🎯
Focusing
View GitHub Profile
View gist:c1335c8dbc50a219b3e9
javascript:(function() %7Bfunction c() %7Bvar e %3D document.createElement("link")%3Be.setAttribute("type", "text/css")%3Be.setAttribute("rel", "stylesheet")%3Be.setAttribute("href", f)%3Be.setAttribute("class", l)%3Bdocument.body.appendChild(e)%7D function h() %7Bvar e %3D document.getElementsByClassName(l)%3Bfor (var t %3D 0%3B t < e.length%3B t%2B%2B) %7Bdocument.body.removeChild(e%5Bt%5D)%7D%7D function p() %7Bvar e %3D document.createElement("div")%3Be.setAttribute("class", a)%3Bdocument.body.appendChild(e)%3BsetTimeout(function() %7Bdocument.body.removeChild(e)%7D, 100)%7D function d(e) %7Breturn %7Bheight : e.offsetHeight,width : e.offsetWidth%7D%7D function v(i) %7Bvar s %3D d(i)%3Breturn s.height > e %26%26 s.height < n %26%26 s.width > t %26%26 s.width < r%7D function m(e) %7Bvar t %3D e%3Bvar n %3D 0%3Bwhile (!!t) %7Bn %2B%3D t.offsetTop%3Bt %3D t.offsetParent%7Dreturn n%7D function g() %7Bvar e %3D document.documentElement%3Bif (!!window.innerWidth) %7Breturn window.innerHeight%7D else if (e %26%2
View gist:9350cf9c45b432f1fb81
aimees.cn
kafan.cn
so.ttywx.com
so.yunfei89.com
001nlp.com
111cn.net
151.com.tw
15meili.com
258369.cn
28im.com
@ryanlid
ryanlid / mobile.html
Created Jun 24, 2016
移动端html基本结构
View mobile.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>title</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="./css/main.css">
</head>
@ryanlid
ryanlid / index.html
Created Jul 8, 2016
地区列表,拼音
View index.html
<!--地区-->
<div class="area option-list hidden" id="area">
<ul>
<li><input name="area" value="北京" type="checkbox" id="beijing" hidden><label for="beijing">北京</label></li>
<li><input name="area" value="上海" type="checkbox" id="shanghai" hidden><label for="shanghai">上海</label></li>
<li><input name="area" value="天津" type="checkbox" id="tianjin" hidden><label for="tianjin">天津</label></li>
<li><input name="area" value="重庆" type="checkbox" id="chongqin" hidden><label for="chongqin">重庆</label></li>
<li><input name="area" value="河北" type="checkbox" id="hebei" hidden><label for="hebei">河北</label></li>
<li><input name="area" value="山西" type="checkbox" id="shanxi" hidden><label for="shanxi">山西</label></li>
<li><input name="area" value="河南" type="checkbox" id="henan" hidden><label for="henan">河南</label></li>
@ryanlid
ryanlid / meta.html
Created Jul 10, 2016
移动前端 meta
View meta.html
<!--设置viewport宽度为屏幕的宽度,禁用缩放比例-->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
 
<meta name="apple-mobile-web-app-capable" content="yes" />
 
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
 <!--关闭iOS Safari 的电话号码识别和android的邮箱识别-->
<meta name="format-detection"content="telephone=no, email=no" />
 
<!-- iOS 移动设备添加主屏幕标题设置 -->
@ryanlid
ryanlid / index.html
Created Jul 13, 2016
jQuery 在新窗口打开外部链接
View index.html
<script>
var myURL = location.protocol + '//' + location.hostname;
$('a[href^= "http://"]').not('[href^= "'+myURL+'"]').attr('target','_blank');
</script>
@ryanlid
ryanlid / index.html
Created Jul 14, 2016
返回上一页的几种写法~
View index.html
<a href="javascript:history.go(-1)">返回上一页</a>
<a href="javascript:location.reload()">刷新当前页面</a>
<a href="javascript:" onclick="history.go(-2); ">返回前两页</a>
<a href="javascript:" onclick="self.location=document.referrer;">返回上一页并刷新</a>
<a href="javascript:" onclick="history.back(); ">返回上一页</a>
@ryanlid
ryanlid / index.html
Created Jul 17, 2016
获取浏览器高度
View index.html
alert($(window).height()); //浏览器时下窗口可视区域高度
alert($(document).height()); //浏览器时下窗口文档的高度
alert($(document.body).height());//浏览器时下窗口文档body的高度
alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin
alert($(window).width()); //浏览器时下窗口可视区域宽度
alert($(document).width());//浏览器时下窗口文档对于象宽度
alert($(document.body).width());//浏览器时下窗口文档body的高度
alert($(document.body).outerWidth(true));//浏览器时下窗口文档body的总宽度 包括border padding margin
alert($(document).scrollTop()); //获取滚动条到顶部的垂直高度
alert($(document).scrollLeft()); //获取滚动条到左边的垂直宽度
@ryanlid
ryanlid / .editorconfig
Last active May 2, 2017
EditorConfig是一套用于统一代码格式的解决方案
View .editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@ryanlid
ryanlid / regexp.js
Created Sep 7, 2016
常用的正则表达式
View regexp.js
// 验证是否为Email地址
function isPhoneNum(str) {
var pattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
if (pattern.test(str)) {
return true;
} else {
return false;
}
}