Skip to main content

Creating progress bar using JavaScript and Bootstrap And code of progress bar.


Hey guy's in this tutorial i talk about making a working progress bar using BootStrap and javascript . Here in this tutorial i will be showing some code and effects that can be used to make a progrress bar. First of all Why does we use progress bar ?.
This question would be arising in yours mind while reading this blog .Then answer is progress bar is some events that help us to show progress of some events like "page is loading" and this xyz% the page is loaded or can be used to show the loading of the image or any event carried by ajax.

Making the progress bar really easy stuff all css part is taken out by the bootStrap just you have to take care of coding part .You have to only worry about the coding script other wise all other stuff are taken care by bootstrap.In this i will show you all readers a example with code that will help you to create a working progress bar with ease
Below is the example show how the progress ball will work when some event is done like clicking the button .Bellow is the code showing the triggering of the event that is carried out when button is click . Instead of show this event you just have to change the script that should run while the page is loaded or showing percentage of completeness of some events .

Below is code for above example .This code shows how the button is clicked and progress bar start showing progress


 <script >
    var j;
  var my;
 
   function call(){
   j++;
 
$("#x").css("width",j+"%");
document.getElementById("demo").innerHTML=j+"%";

if(j==100)
  {

clearInterval(my);
  }


     
   }
 
   function bar(){
 $("#x").css("width",j+"%");
  j=0;
   my=setInterval(function(){ call();},100);
 
   }

   </script>

<div class="progress">
  <div id="x" class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="70"
  aria-valuemin="0" aria-valuemax="100" style="width:0%" >
   </div>


</div>
<div id="demo"></div>
<button type="button" onclick="bar();">click to run progress bar</button>
  </div>


Explanation !
When ever the button is clicked then bar(); function is called and which set the value of j variable as 0 and set it's value in css property of "id =x" div "

<div aria-valuemax="100" aria-valuemin="0" aria-valuenow="70" class="progress-bar progress-bar-striped active" id="x" role="progressbar" style="width: 0%;">"

And setInterval(function(){ call();},100); which regularly call for call(); after each 100 millisecond until intervalclear() function is called . This set the width value from 0 to 100% regularly .

Comments

Post a Comment

Popular posts from this blog

How to Create a Bootable Pendrive for Installing Windows

For installing windows to PC it is required to make a bootable cd or pendrive.Windows can be install in OS by two ways . 1.By using Pendrive. 2.OR by using DVD First one i.e using pendrive to install windows is more acceptable because installing windows through pendrive is faster than installing window

2016 Aternative of Google Adsense for Advertising On Website or Blog .

Google Adsense is one of the most trustworthy and genuine way of earning making earning from website through displaying adds on it .Any one can earn very much good amount of  money through google adsense but to start earning from google adsense you must make sure that your website follows all the guidelines for getting accepted by google adsense. Getting approval from google adsense is lengthy process .First of all your website for which you are applying should be six month old for the user of India and china  and should also follow each guidelines from adsense policy . Making all acceptance for adsense approval is very hard and every one can not get it very easily it will take atleast 7 to 8 month .

Specification of APPO A37

Leading Chinese Mobile company APPO has launched APPO A37 with mind blowing specification . The sell of this mobile will start from 1st July 2016. This is APPO A37 is high tech mobile with all specification installed in it . This mobile  is eqquiped with 8mp rear and 5 mp front camera with expandable 128 Gb memory storage .APPO A37 comes with mediatech    MT6750 processor and 2Gb of RAM . This phone is capable of taking high Quality pictures with its 8 MP Camera . APPO A37 will be available at RS 11990 to the customers . Highlights - 1.2GHz MSM8916 Snapdragon Quad-Core Processor - 2GB RAM With 16GB ROM - 5 Inch HD IPS TFT Display With 293PPI - Dual Nano SIM - 8 MP Rear Camera With LED Flash - 5 MP Front Camera - 4G - Bluetooth 4.0 - Wi-Fi - 2630 MAh Battery