Skip to content

Instantly share code, notes, and snippets.

// 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'];
// 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
<!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>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>iScroll demo: horizontal scroll</title>
<script type="application/javascript" src="iscroll.js"></script>
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
/**
* 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
*
// execute script inside iframe
$('#iframe', parent.document).height($(document.body).outerHeight());
@robertsky123
robertsky123 / iframe-document.js
Last active December 16, 2015 05:29 — forked from rwaldron/iframe-document.js
获取iframe中的函数和元素
var iframe = document.getElementById("my-iframe"),
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).myfunction();//访问函数
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;//访问dom结构
console.log( iframeDoc );