Skip to content

Instantly share code, notes, and snippets.

View adrianstainforth's full-sized avatar

Adrian Stainforth adrianstainforth

View GitHub Profile
@adrianstainforth
adrianstainforth / gist:7139190
Created October 24, 2013 15:24
responsive iframe
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(window).on("DOMContentLoaded resize orientationchange", function(){
console.log("changing", $("body").outerHeight())
$(parent.document.body).find("#iframe").height($("body").outerHeight() + 30)
})
</script>
@adrianstainforth
adrianstainforth / pjax_setup.js.coffee
Created November 7, 2012 11:21
PJAX JavaScript
#Checks if push state is available
if (history && history.pushState)
#sets higher time out other wise pjax aborts a lot
$.pjax.defaults.timeout = 10000
$(document).pjax("a.pjax", "[data-pjax-container]").on "pjax:end", ->
#Trigger code that needs to happen on page load
@adrianstainforth
adrianstainforth / CSS3Transitions.js
Created November 7, 2012 10:35
Feature Detection
//Detect CSS3 Transitions
var cssTransitionsSupported = false;
(function() {
var div = document.createElement('div');
div.innerHTML = '<div style="-webkit-transition:color 1s linear;-moz-transition:color 1s linear;"></div>';
cssTransitionsSupported = (div.firstChild.style.webkitTransition !== undefined) || (div.firstChild.style.MozTransition !== undefined);
// console.log(cssTransitionsSupported);
delete div;
})();