Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head>
<title>Test Fading a page in</title>
<style type="text/css">
body {
-moz-opacity: 0;
-khtml-opacity: 0;
opacity: 0;
}
</style>
<script type="text/javascript">
window.onload = fadeInPage;
var fadeStep = 0.1;
var fadeSpeed = 100; // milliseconds (smaller is faster)
function fadeInPage() {
fadePage('in');
}
var fadeHndl = null;
function fadePage(direction) {
var node = document.getElementsByTagName('body')[0];
if (fadeHndl == null) {
node.myOpacity = (direction == 'in') ? 0 : 1;
fadeHndl = setInterval('fadePage("' + direction + '")', fadeSpeed);
} else {
var opacity = getOpacity(node);
if ((opacity >= 1 && direction == 'in') || (opacity <= 0 && direction == 'out')) {
clearInterval(fadeHndl);
fadeHndl = null;
} else {
var newOpacity = (direction == 'in') ? opacity + fadeStep : opacity - fadeStep;
setOpacity(node, newOpacity);
}
}
}
function setOpacity(node, opacity) {
node.myOpacity = opacity;
if (node.style.filter == 'undefined') {
node.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (opacity * 100) + ')';
} else {
node.style.MozOpacity = opacity;
node.style.KhtmlOpacity = opacity;
node.style.opacity = opacity;
}
}
function getOpacity(node) {
if (typeof(node.myOpacity) != 'undefined') return(parseFloat(node.myOpacity));
return(1);
}
</script>
</head>
<body>
<h1>Lorem ipsum</h1>
<p>Dolor sit amet.</p>
</body>
</html>