Fallen
Fallen

Reputation: 35

Progress bar not filling with progress bar script tag

The expected result is that when the page loads, the progress bar loads like this: https://i.sstatic.net/xThgR.png

However the result I get is a progress bar with no progress, like this: https://i.sstatic.net/vH9oh.png

The link for jQuery and semantic/fomantic UI libararies is listed below:

<link rel="stylesheet" type="text/css" href="semantic/dist/semantic.min.css">
    <script
        src="https://code.jquery.com/jquery-3.1.1.min.js"
        integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
        crossorigin="anonymous"></script>
    <script src="semantic/dist/semantic.min.js"></script>
    <script>
        $('#progressHTML').progress();
    </script>

The actual area in the website that has the progress bar is below:

<div id="skills" class="skills-containter">
        <div class="skills-text-containter">
            <h1 class="ui header skills-header">Skills</h1>
            <div class="ui blue progress" data-percent="74" id="progressHTML">
                <div class="bar"></div>
                <div class="label">HTML</div>
              </div>
            <p class="ui paragraph skills-paragraph">no</p>
        </div>
    </div>

Any help would be appreciated. :)

Upvotes: 2

Views: 326

Answers (1)

Maycon Mesquita
Maycon Mesquita

Reputation: 4590

You forgot to add $('#progressHTML').progress(); inside a jQuery's ready event, like this:

$(document).ready(function() {
  $('#progressHTML').progress();
});

An example is working in a codepen that i made:

https://codepen.io/mayconmesquita/pen/YzyGvVN

codepen example

The Code:

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
<script
        src="https://code.jquery.com/jquery-3.1.1.min.js"
        integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
        crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
<script>
  $( document ).ready(function() {
    $('#progressHTML').progress();
  });
</script>

<div id="skills" class="skills-containter">
  <div class="skills-text-containter">
    <h1 class="ui header skills-header">Skills</h1>
    <div class="ui blue progress" data-percent="74" id="progressHTML">
      <div class="bar"></div>
      <div class="label">HTML</div>
    </div>
    <p class="ui paragraph skills-paragraph">no</p>
  </div>
</div>

Upvotes: 3

Related Questions