Skip to content

Commit

Permalink
Add preloader for site front layout
Browse files Browse the repository at this point in the history
  • Loading branch information
DungDA committed Oct 29, 2020
1 parent c18c4b6 commit 177aa71
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 100 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"scripts": {
"watch": "webpack --mode=development --watch -d",
"start": "npm run watch",
"build": "webpack --mode=production"
},
"author": "",
Expand Down
5 changes: 3 additions & 2 deletions project/app/static/webpack_sources/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
import "../scss/index.scss";

// Js
import "./home_page.js";
import "./ho_dan.js";
import "./home_page";
import "./ho_dan";
import "./preloader"
14 changes: 14 additions & 0 deletions project/app/static/webpack_sources/js/preloader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import $ from 'jquery';

const waitWebpackAndStyleLoader = 1100;

// End preloader when webpack is ready
$(document).ready(() => {
setTimeout(() => {
$('#loader').slideUp("fast", () => {
$('body').removeClass('cuuhomientrung__preloader');
$('#loader').remove();
$('#loader__wrapped').show();
});
}, Math.floor(Math.random() * waitWebpackAndStyleLoader));
});
Loading

0 comments on commit 177aa71

Please sign in to comment.