Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.65 KB | None | 0 0
  1. Following Steps:
  2. 1: HTML Part
  3. 2: Additional CSS Part (style.css)
  4. 3: Progress bar CSS Part (circle-progresbar.css)
  5. 4: Progress Bar JS Part (circle-progresbar.js)
  6. NOTE: Default jquery version is: jquery-3.3.1.min.js
  7. .
  8. Thats all.................
  9.  
  10.  
  11.  
  12. /***************HTML PART***************/
  13. <section class="skill-section" id="skill">
  14. <div class="container">
  15. <div class="row">
  16. <div class="col-lg-3 col-md-3 col-sm-6">
  17. <svg class="radial-progress web" data-percentage="90" viewBox="0 0 80 80">
  18. <circle class="incomplete" cx="40" cy="40" r="35"></circle>
  19. <circle class="complete" cx="40" cy="40" r="35" style="stroke-dashoffset:39.58406743523136;"></circle>
  20. <text class="percentage" x="50%" y="57%" transform="matrix(0, 1, -1, 0, 80, 0)">90%</text>
  21. </svg>
  22. <h3>Web design</h3>
  23. </div>
  24. <div class="col-lg-3 col-md-3 col-sm-6">
  25. <svg class="radial-progress ui" data-percentage="85" viewBox="0 0 80 80">
  26. <circle class="incomplete" cx="40" cy="40" r="35"></circle>
  27. <circle class="complete" cx="40" cy="40" r="35" style="stroke-dashoffset:39.58406743523136;"></circle>
  28. <text class="percentage" x="50%" y="57%" transform="matrix(0, 1, -1, 0, 80, 0)">85%</text>
  29. </svg>
  30. <h3>UI/UX</h3>
  31. </div>
  32. <div class="col-lg-3 col-md-3 col-sm-6">
  33. <svg class="radial-progress html-css" data-percentage="70" viewBox="0 0 80 80">
  34. <circle class="incomplete" cx="40" cy="40" r="35"></circle>
  35. <circle class="complete" cx="40" cy="40" r="35" style="stroke-dashoffset:39.58406743523136;"></circle>
  36. <text class="percentage" x="50%" y="57%" transform="matrix(0, 1, -1, 0, 80, 0)">70%</text>
  37. </svg>
  38. <h3>HTML/CSS</h3>
  39. </div>
  40. <div class="col-lg-3 col-md-3 col-sm-6">
  41. <svg class="radial-progress wp" data-percentage="95" viewBox="0 0 80 80">
  42. <circle class="incomplete" cx="40" cy="40" r="35"></circle>
  43. <circle class="complete" cx="40" cy="40" r="35" style="stroke-dashoffset:39.58406743523136;"></circle>
  44. <text class="percentage" x="50%" y="57%" transform="matrix(0, 1, -1, 0, 80, 0)">95%</text>
  45. </svg>
  46. <h3>Wordpress</h3>
  47. </div>
  48. </div>
  49. </div>
  50. </section>
  51.  
  52.  
  53.  
  54.  
  55. /**************CSS PART**************/
  56. .skill-section {
  57. background: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)), url(../img/skill/img.jpg);
  58. width: 100%;
  59. background-repeat: no-repeat;
  60. background-size: cover;
  61. }
  62.  
  63. svg.radial-progress circle{
  64. stroke-width: 3;
  65. }
  66.  
  67. svg.radial-progress text{
  68. fill: #000;
  69. }
  70.  
  71. svg.web circle{
  72. stroke: #CC1DB9;
  73. }
  74.  
  75. svg.ui circle{
  76. stroke: #8f58f6;
  77. }
  78.  
  79. svg.html-css circle{
  80. stroke: #a6ce39;
  81. }
  82.  
  83. svg.wp circle{
  84. stroke: #2a3682;
  85. }
  86.  
  87.  
  88.  
  89. /**************ADDITIONAL CSS PART**************/
  90. svg.radial-progress {
  91. height: auto;
  92. max-width: 200px;
  93. padding: 1em;
  94. transform: rotate(-90deg);
  95. width: 100%;
  96. }
  97.  
  98. svg.radial-progress circle {
  99. fill: rgba(0,0,0,0);
  100. stroke: #fff;
  101. stroke-dashoffset: 219.91148575129;
  102. stroke-width: 10;
  103. }
  104.  
  105. svg.radial-progress circle.incomplete { opacity: 0.25; }
  106.  
  107. svg.radial-progress circle.complete { stroke-dasharray: 219.91148575129; }
  108.  
  109. svg.radial-progress text {
  110. fill: #fff;
  111. text-anchor: middle;
  112. }
  113.  
  114.  
  115.  
  116.  
  117. /**************ADDITIONAL JS PART**************/
  118. $('svg.radial-progress').each(function( index, value ) {
  119. $(this).find($('circle.complete')).removeAttr( 'style' );
  120. });
  121.  
  122. $(window).scroll(function(){
  123. $('svg.radial-progress').each(function( index, value ) {
  124. // If svg.radial-progress is approximately 25% vertically into the window when scrolling from the top or the bottom
  125. if (
  126. $(window).scrollTop() > $(this).offset().top - ($(window).height() * 0.75) &&
  127. $(window).scrollTop() < $(this).offset().top + $(this).height() - ($(window).height() * 0.25)
  128. ) {
  129. // Get percentage of progress
  130. percent = $(value).data('percentage');
  131. // Get radius of the svg's circle.complete
  132. radius = $(this).find($('circle.complete')).attr('r');
  133. // Get circumference (2πr)
  134. circumference = 2 * Math.PI * radius;
  135. // Get stroke-dashoffset value based on the percentage of the circumference
  136. strokeDashOffset = circumference - ((percent * circumference) / 100);
  137. // Transition progress for 1.25 seconds
  138. $(this).find($('circle.complete')).animate({'stroke-dashoffset': strokeDashOffset}, 1250);
  139. }
  140. });
  141. }).trigger('scroll');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement