hoping you can help on something.. new to jQuery & javascript, but trying to have a loading cover page, so all the content is showed at once, but its stuck and wont go past the loading page, yet on the jsfiddle it will go past the loading page which doesnt make sense.
here's the fiddle - http://jsfiddle.net/adeneo/Egtwx/1/
and here's my code (which is the same...
<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>
here is all the code in my script tag at the moment, maybe this is clashing and causing it not to work..?
<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>