Skip to content

Instantly share code, notes, and snippets.

View axelmichel's full-sized avatar

Axel Michel axelmichel

View GitHub Profile
@axelmichel
axelmichel / durationtransitionprop.js
Created January 13, 2017 22:58
Extracting the transition with the longest duration (and delay)
function getMaxDurationTransitionProperty(el) {
// small helper to extract the values
function extract(str) {
return str
.replace(/[A-Z]/gi, "")
.split(", ")
.map(parseFloat);
};
// get the current style
var style = getComputedStyle(el);
@axelmichel
axelmichel / blurry-example.html
Created February 1, 2016 10:12
facebook like unblur effect with tiny images onload and src switch after
<img class="blurry" src="super-tinyimage-small.jpg" />
<div class="blurry" style="background-image:url(super-tinyimage-small.jpg);"></div>
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}