admin管理员组文章数量:1291123
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)});
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)});
Share
Improve this question
asked Sep 3, 2013 at 1:55
bennybenny
4742 gold badges7 silver badges16 bronze badges
8
- We are going to need to see a live example of it not working.. or just more coding. – Josh Crozier Commented Sep 3, 2013 at 1:57
- What happens when it fails? – Dan-Nolan Commented Sep 3, 2013 at 1:57
- Yes, and what I mean does and doesn't it that it fades in sometimes and sometimes it just statically loads without fading in. – benny Commented Sep 3, 2013 at 1:58
- Nevermind, I got it working. Allocated the script to load first before other scripts. – benny Commented Sep 3, 2013 at 2:00
- 1 @Blake I tried your script jsfiddle/TsYr7 ... It's working fine.. – Ganesh Babu Commented Sep 3, 2013 at 2:03
4 Answers
Reset to default 2set to priority before other scripts.
$(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);});
Check out some Loading effect at CODROPS Article .. u may find it useful http://tympanus/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.
本文标签: javascriptFade in effect on page loadStack Overflow
版权声明:本文标题:javascript - Fade in effect on page load - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741516727a2382934.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论