This file contains hidden or 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
-webkit-tap-highlight-color: rgba(0,0,0,0); |
This file contains hidden or 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
ifr.contentDocument.documentElement.innerHTML | |
if (document.all){//IE | |
doc = document.frames["MyIFrame"].document; | |
}else{//Firefox | |
doc = document.getElementById("MyIFrame").contentDocument; | |
} | |
1. 获得iframe的window对象 |
This file contains hidden or 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 methods = { | |
init : function( options ) { | |
return this.each(function(){ | |
var $this = $(this), | |
data = $this.data('myPlugin'); |
This file contains hidden or 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
正则匹配 | |
匹配中文字符的正则表达式: [\u4e00-\u9fa5] | |
评注:匹配中文还真是个头疼的事,有了这个表达式就好办了 | |
匹配双字节字符(包括汉字在内):[^\x00-\xff] | |
评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1) | |
匹配空白行的正则表达式:\n\s*\r | |
评注:可以用来删除空白行 |
This file contains hidden or 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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>三角测试</title> | |
<style type="text/css"> | |
body{padding:50px;} | |
.san1{position:relative; _height:0px; _line-height:0px;} /* IE6要使用 _height:0px; _line-height:0px; 修正 */ | |
.emborder1{ | |
display:block; |
This file contains hidden or 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> | |
<head> | |
<title>ie中垂直居中</title> | |
<meta charset=UTF-8"> | |
<style type="text/css"> | |
#div1{ | |
width:300px; | |
position:absolute; | |
border:1px solid #000; |
This file contains hidden or 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 detectua(ua) { | |
var os = {}, | |
browser = {}, | |
android = ua.match(/([a|A]ndroid)[\s\/]*([\d.]+)/), | |
ipad = ua.match(/(iPad).*OS\s([\d_]+)/), | |
iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/), | |
wechat = ua.match(/MicroMessenger\/([\d\.]+)/), | |
qqbrowser = ua.match(/MQQBrowser\/([\d\.]+)/); | |
if (/android/i.test(ua)) { | |
os.android = true; |
This file contains hidden or 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 getDocRect = function(doc){ | |
doc = doc || document; | |
var win = doc.defaultView || doc.parentWindow, | |
mode = doc.compatMode, | |
root = doc.documentElement, | |
h = win.innerHeight || 0, | |
w = win.innerWidth || 0, | |
scrollX = win.pageXOffset || 0, | |
scrollY = win.pageYOffset || 0, |
This file contains hidden or 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 Browser = (function(){ | |
var na = window.navigator, | |
ua = na.userAgent.toLowerCase(), | |
browserTester = /(msie|webkit|gecko|presto|opera|safari|firefox|chrome|maxthon|android|ipad|iphone|webos|hpwos)[ \/os]*([\d_.]+)/ig, | |
Browser = { | |
platform: na.platform | |
}; | |
ua.replace(browserTester, function(a, b, c) { | |
var bLower = b.toLowerCase(); | |
if (!Browser[bLower]) { |
This file contains hidden or 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 printf = function (tmpl) { | |
var i = 1, args = arguments, l = args.length; | |
return tmpl.replace(/%s/g, function () { | |
return (i < l ? args[i++] : ''); | |
}); | |
} | |
printf('%s:%s!', 'test', 'woo!'); // test:woo!! |
OlderNewer