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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
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
// relies on Date.now() which has been supported everywhere modern for years. | |
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values | |
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page | |
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed | |
(function(){ | |
// prepare base perf object |
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Fixed Toolbars Polyfill</title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.css"> | |
<link rel="stylesheet" href="jquery.mobile.fixedToolbar.polyfill.css"> | |
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> |
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 supports3d() { | |
// borrowed from modernizr | |
var div = document.createElement('div'), | |
ret = false, | |
properties = ['perspectiveProperty', 'WebkitPerspective']; | |
for (var i = properties.length - 1; i >= 0; i--){ | |
ret = ret ? ret : div.style[properties[i]] != undefined; | |
}; | |
// webkit has 3d transforms disabled for chrome, though |
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
/** | |
* jQuery.support.cssProperty | |
* To verify that a CSS property is supported (or any of its browser-specific implementations) | |
* | |
* @param string p - css property name | |
* [@param] bool rp - optional, if set to true, the css property name will be returned, instead of a boolean support indicator | |
* | |
* @Author: Axel Jack Fuchs (Cologne, Germany) | |
* @Date: 08-29-2010 18:43 | |
* |
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
// execute script inside iframe | |
$('#iframe', parent.document).height($(document.body).outerHeight()); |
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 iframe = document.getElementById("my-iframe"), | |
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).myfunction();//访问函数 | |
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;//访问dom结构 | |
console.log( iframeDoc ); |