Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Optimized version of amelie.js for IE6
if(document.all&&!window.XMLHttpRequest){(function(){var b=1,a=0,e,c;function d(){if(b==2){b=0}if(!b++){e=c=0;a=~~(Math.random()*10000)+2000;setTimeout(d,a)}else{e=~~(Math.random()*2)+2;c=~~(Math.random()*360);setTimeout(d,500)}document.body.style.filter="progid:DXImageTransform.Microsoft.MotionBlur(strength="+e+",direction="+c+",enabled='true')"}setTimeout(d,1000)})()}
// Here’s a rewrite of Paul’s rewrite of amelie.js
// Avoids global variables and eval()
// http://icant.co.uk/ie6-amelie/
if (document.all && !window.XMLHttpRequest) {
(function() {
var x = 1,
when = 0,
str,
dir;
function amelie() {
if (x == 2) {
x = 0;
};
if (!x++) {
str = dir = 0;
when = ~~(Math.random() * 1e4) + 2e3;
setTimeout(amelie, when);
} else {
str = ~~(Math.random() * 2) + 2;
dir = ~~(Math.random() * 360);
setTimeout(amelie, 500);
};
document.body.style.filter = "progid:DXImageTransform.Microsoft.MotionBlur(strength=" + str + ",direction=" + dir + ",enabled='true')";
};
setTimeout(amelie, 1000);
})();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.