【发布时间】:2016-05-20 23:01:23
【问题描述】:
希望您能在某些事情上有所帮助.. jQuery 和 javascript 的新手,但尝试加载封面页面,以便立即显示所有内容,但它卡住并且不会超过加载页面,但在 jsfiddle它会经过没有意义的加载页面。
这是小提琴 - http://jsfiddle.net/adeneo/Egtwx/1/
这是我的代码(相同...
<div id="cover">LOADING</div>
<script>
$(window).on('load', function() {
$("#cover").fadeOut(1000);
});
//jsFiddle does not fire the window onload properly, substituted with fake load
function newW() {
$(window).load();
}
setTimeout(newW, 100);
</script>
这是我的脚本标签中的所有代码,也许这是冲突并导致它不起作用..?
<script>
$(window).ready(function() {
$("#cover").fadeOut(2000);
});
//jsFiddle does not fire the window onload properly, substituted with fake load
function newW() {
$(window).load();
}
setTimeout(newW, 100);
$(document).ready(function() {
//Check to see if the window is top if not then display button
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function() {
$('html, body').animate({
scrollTop: 0
}, 800);
return false;
});
});
</script>
【问题讨论】:
标签: javascript jquery