Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Shopify Community Downtime: The Shopify Community will be down December 5th for 15 minutes between 3pm and 4pm EST. Thank you for your understanding.

Adding fadeout to preload screen

Adding fadeout to preload screen

alqur
Visitor
2 0 0

Hi, Im trying to add a fadeout as opposed to an abrupt ending to my preload screen. Can't get anything to work. Can anyone help?

 

<div id="preloader">

</div>


<script type="text/javascript">

(


function()

{


var preload = document.getElementById("preloader");

var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);

var loading = 0;

var id = setInterval(frame, 30);

function frame()

{

if(loading == 70)

{

clearInterval(id);

}

else

{

loading = loading + 1;

if(! isMobile)

{

if(loading == 60)

{

preload.style.opacity = "0";

preload.style.display = "none";

}

Replies 0 (0)