简体   繁体   中英

Javascript , loading progress bar before site loads

I want to make a progress bar for a GUI site that I am making and I need a bit of code in javascript to detect if the site is loading and how many elements/images have loaded and has the site fully loaded. I have the progress bar made with css and I dont know how I can turn on/of elements in js.

How can I accomplish this in js or by using Jquery ?

Some solutions to achieve what you want are:

  • Code a really little page with nothing but your favourite js framework (jQuery maybe?) and a little code that requests the rest of the elements of the page dinamically with AJAX counting which ones are finished or not with the load events.
  • For images you can also link "load" event and do a progress bar counting the total images grated/images loaded.
  • Other combiantions of the other two.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM