Skip to content

Commit

Permalink
correction loader timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bmiit145 committed Mar 1, 2024
1 parent 3b525fd commit 34cd4a1
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,40 @@
// loader

//for testing

// var loader = function() {
// setTimeout(function() {
// if($('#ftco-loader').length > 0) {
// $('#ftco-loader').removeClass('show');
// }
// }, 100000);
// };
// loader();

window.addEventListener("load", function() {
var loader = document.querySelector("#ftco-loader");
var timeoutId = setTimeout(function() {
loader.style.display = "none";
}, 5000);

// Clear the timeout if the page finishes loading before 5 seconds
window.addEventListener("load", function() {
clearTimeout(timeoutId);
loader.style.display = "none";
$(document).ready(function() {
var loader = $('#ftco-loader');

// Function to hide the loader
var hideLoader = function() {
loader.fadeOut();
};

// Hide the loader if content or window is already loaded
$(window).on('load', function() {
hideLoader();
});

// Set a timeout to hide the loader after 5 seconds
setTimeout(function() {
hideLoader();
}, 5000);
});

// loader

// window.addEventListener("load", function() {
// var loader = document.querySelector("#ftco-loader");
// var timeoutId = setTimeout(function() {
// loader.style.display = "none";
// }, 5000);
//
// // Clear the timeout if the page finishes loading before 5 seconds
// window.addEventListener("load", function() {
// clearTimeout(timeoutId);
// loader.style.display = "none";
// });
// });


// Scrollax
Expand Down

0 comments on commit 34cd4a1

Please sign in to comment.