A handy tutorial on creating Page Load Progress Bar using Pace.js

A website isn't complete without the inclusion of all the right elements. Progress bar is one of the key components of every website. It informs the user about the total waiting time for a particular web page or a specific task to load. Apart from adding value to the website, the progress bar is also capable of enhancing the overall user-friendly experience. Today, through this article I'll be offering you a detailed insight into all the steps that are involved with creation of a page load progress bar using the built-in JavaScript plugin called Progress Automatically Certain to Entertain(Pace.js).

A brief on using Pace.js As a lightweight JavaScript library, Pace.js comprises of an amazing porgress bat that works flawlessly for your page load and Ajax navigation. With this plug-in, you can ensure automatic loading of the progress bar within any web page. In addition to this, the plugin-in can be easily executed using an event loop, document-read state and several Ajax requests. Equipped with 14 built-in themes, Pace.js is perfect for adding a unique and fully-functional progress bar into your website. Pre-requisites for creating page load progress bar using Pace.js 1. A good background image 2. Pace.js Getting Started with using Pace.js

Step 1- Include Pace.js and a CSS theme on the Head section. Here's the code involved for the same:

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <title>Create your own page load progress bar with Pace.js</title>
    <script src="js/pace.js"></script>
    <link href="css/pace-theme-corner-indicator.css" rel="stylesheet">

Step 2- Since Pace.js is fully automatic, you need do any kind of configuration. You can opt for performing some tweaks as explained below: Set the window.paceOptions by including the below mentioned code snippet:

paceOptions = {
  // Disable the 'elements' source
  elements: false,
  // Only show the progress on regular and ajax-y page navigation,
  // not every request
  restartOnRequestAfter: false

Insert the above options in the script tag using the below line of code:

Step 3- You can also opt for customizing the color of the progress bar in any one of the below mentioned ways: Customize the colors via Pace.js themes page available here Go to the CSS file and opt for changing the colors of background and border And that's it. With the successful completion of this third step you're done with the process of incorporating a beautiful page loading progress bar. Loaded with a bunch of eye-catchy ready-to-use themes, Pace.js doesn't let you worry about the hassles that are associated with implementing a loading page progress bar into your website.

Summary So, that was a brief outlook of the basic steps involved with the inclusion of a page load progress bar into a website using Pace.js plug-in. Hope you'd have liked going through the article and the details covered here would assist you with your forthcoming venture of including a beautiful and fast loading progress bar in your web pages.

As a web developer,cline has helped companies gain momentum with their large and small scale projects. She is currently working for Xicom Technologies Ltd, a leading Web Development Company. In addition to being a part of Xicom's PHP team, she loves spinning articles/blogs on diverse web development tips & tricks. If you are looking for hire dedicated php developers, you can get in touch with her or directly contact Xicom Technologies Ltd.

Celin Smith Celin Smith is Java developer and blogger at Xicom who loves to write about web & mobile apps. Xicom is a one of the leading Java Development Outsourcing Company which provides different array of genuine software solutions like Custom Software Development, IT Outsourcing Services, Web application development services to its clients globally. Xicom Technologies Ltd., a software development realm, is a CMMI Level-3 & ISO 9001 Certified company that is renowned for providing top-notch services to its global clientele.
  • javascript
  • pace.js
  • developer
  • php developer
By Celin Smith On 18 Feb, 15  Viewed: 4,970

Other blogs you may like

JavaScript isNaN function and usage

In JavaScript we have a function isNan (Not a number) to check whether the value is a number or not. It takes only one parameter, value and returns true or false, we will check here some values and conditions to understand it better. It supports in all browsers. isNaN(123); // false --... By Jason Olivera   On 30 Mar 2013  Viewed: 535

JavaScript Array: Create, Aceess and Methods

ArrayList and JavaScript, How to declare and store an ArrayList inside JavaScript, create an array in javascript, add item to javascript array, delete an item in an array in javascript, find an item in an array in javascript, these are the very basic question which most of the new developer... By Hamden   On 30 Dec 2012  Viewed: 843

Use JavaScript to hide and show text and graphics

You can show and hide the content to get attention of the user on a web page. it's a very useful thing for web designer and web developers. You can use JavaScript and CSS to achieve it. I am going to show some examples of it. There are many libraries available on internet having the feature to... By Hamden   On 30 Dec 2012  Viewed: 781

JavaScript getAttribute() Method

In JavaScript getAttribute() method is used to get the value of an attribute in an object. **Syntax:** object.getAttribute(attributename) **Parameter:** It takes only one parameter *attributename* **Example:** Suppose you have an anchor tag with following attributes <a... By Alicia Gonzalez   On 02 Dec 2012  Viewed: 704

How to retrieve data from database using JavaScript in asp.net

I was checking how to validate a user email from database without post back, using JavaScript. After some search and RND found the way to call the web service method with the help of Ajax and JavaScript. Let’s say we have a registration page on which we accept email from the user and we expect... By Ali Adravi   On 24 Jun 2012  Viewed: 14,670