jquery - Progress bar query -
i created progress bar i'm facing new problems:
- i want once span clicked turn circle green tick 1 - green:
- i suppose jquery - once click span (circles) - progress bar turns white grey - need white:
- if posible byt clicking asd tag make progress process
fiddles
http://jsfiddle.net/awayf/490/
http://jsfiddle.net/balkics/wxelhzs7/
javascript
$(document).ready(function() { var value=$('#progress-bar').val('0'); $('span').click(function() { if ($(this).hasclass('first')) { $('#progress-bar').val('0'); $(this).nextall().removeclass('border-change'); $('.percent').html("0% complete"); } else if ($(this).hasclass('second')) { $(this).nextall().removeclass('border-change'); $('#progress-bar').val('34'); $(this).find('div').addclass('dott'); $(this).add("<div class='dott'></div>"); $(this).prevall().addclass('border-change'); $(this).addclass('border-change'); $('.percent').html("33% complete"); } else if ($(this).hasclass('third')){ $(this).nextall().removeclass('border-change'); $('#progress-bar').val('67'); $(this).find('div').addclass('dott'); $(this).prevall().addclass('border-change'); $(this).addclass('border-change'); $('.percent').html("66% complete"); } else { $('#progress-bar').val('100'); $(this).find('div').addclass('dott'); $(this).addclass('border-change'); $(this).prevall().addclass('border-change'); $('.percent').html("100% complete"); } }); }); // complete click
html
<div class="cont"> <progress id="progress-bar" min="1" max="100" value="0"></progress> <span class="first border-change"><div class='dott'></div></span> <span class="second"><div class=''></div></span> <span class="third"><div class=''></div></span> <span class="fourth"><div class=''></div></span> <p class="percent">0% complete</p> <a href="#">asd</a> </div>
css
* { box-sizing: border-box; } html,body { height: 100%; width: 100%; padding: 0; margin: 0 ; background-color: rgb(172,172,172); } .cont { height: 100%; width: 576px; left: calc(50% - 288px); padding: 0; margin: 0 auto; position: absolute; } #progress-bar { position:relative; top:100px; width: 576px; height: 2px; margin: 0 auto; } span { height: 20px; width: 20px; border-radius: 100%; border: 2px solid white; background:white; position: absolute; left:0; top: 107px;; cursor: pointer; transition: 0.1s ease-in-out; } p { font-family: arial; font-size: 14pt; text-shadow: 1px 1px 0px #000; color: #fff; text-align: center; } .second { left: 192px; } .third { left: 384px; } .fourth { left: 576px; } #progress-bar::-webkit-progress-value{ /* changes line color */ background: #green; transition: 0.4s ease-in-out; } #progress-bar::-webkit-progress-bar{ /* changes background color */ background: #green; } .border-change { border-color:green; transition: 0.4s ease-in-out; } .dott { position:absolute; width:5px; height:5px; background-color:green; border-radius: 10px; right:35%; top:35%; }
Comments
Post a Comment