-2

I'm trying to create a loading bar, that I'll use when I'll open links or images. I mean, while the page/image isn't loaded yet, a would like to show a loading bar like the one I shown you.
I know how to create the bar in fact, but I don't know how to get the status of the load of the page/image. I imagine that I need to use JavaScript or jQuery, but if you know any way to do this in PHP it would help me.

Loading Bar

Thanks!

DamiToma
  • 921
  • 3
  • 9
  • 27
  • I don't think you can do that. Might be a easier and better to just have a bar that shows that its loading with no status. – DonO Feb 15 '17 at 16:52
  • @DonO And how to do that? – DamiToma Feb 15 '17 at 17:24
  • I'm thinking something like this: https://contingencycoder.files.wordpress.com/2013/08/windows7busyprogressbar.png . Then you can put it on the page and hide it on document loaded. – DonO Feb 15 '17 at 18:07

1 Answers1

1

Loading bar like the above will only work if you are running a php script using ajax. You should understand that php is a server side language, so only when the the server runs the script and shows the output to browser it has already done 100%.

However you can use various libraries https://github.com/verlok/lazyload, http://github.hubspot.com/pace/docs/welcome/

Play with the above two libraries. Ideally pace would be used to show page and lazy load for images

Raj Nandan Sharma
  • 3,694
  • 3
  • 32
  • 42