简体   繁体   中英

Fade in effect on page load

I am trying to make my homepage consistently have a fade in effect when this loads. however, it only works part of the time. This is the current script I am using. I set it to html, since individual div elements didn't seem to work, but setting it to html does and doesn't.

$(document).ready(function () { $('html').hide().fadeIn(1500).delay(6000)});

设置为其他脚本之前的优先级。

 $(document).ready(function () { $('body').hide().fadeIn(1500).delay(6000)});

Try the below code. It will work:

Set ur body first:

<body>
This is my page
</body>

Now the jQuery:

$(document).ready(function(){$("body").hide().fadeIn(1000);});

在CODROPS文章中查看一些加载效果。.您可能会发现它很有用http://tympanus.net/codrops/2013/09/18/creative-loading-effects/

It won't work if the page loads too slow.

Maybe a lot of images(large photos), scripts etc.

Or just because the slow internet connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM