minddust / bootstrap-progressbar

progressbar interactions for twitter bootstrap 2 & 3
www.minddust.com/project/bootstrap-progressbar
MIT License
577 stars 160 forks source link

Call animation on view and use % in aria-valuetransitiongoal field #37

Closed TheZoker closed 10 years ago

TheZoker commented 10 years ago

Hi there,

Two questions:

  1. Is it possible to load the animation, when the user views the poll (without button)?
  2. I use a system and the only way, the value is given is this way: "75%". How can I remove the % sign, so the script can use only the number?

Thank you

minddust commented 10 years ago

hi @TheZoker,

  1. sure you can. just trigger .progressbar() on e.g. document ready
  2. you can provide a custom percent_format method. take a look: https://github.com/minddust/bootstrap-progressbar#percent_format

combined sample:

$(document).ready(function() {
    $('.progress .progress-bar').progressbar({
        percent_format: function(percent) { return percent; }
    });
});
TheZoker commented 10 years ago

But the percent_format does only change the output and not the input, right?

Here is a demo: http://demo.zoker.me/proBoot3/viewtopic.php?f=2&t=4

minddust commented 10 years ago

this has nothing directly to do with this lib but here you go:

var v = "75%";
var like_this = v.replace(/%/, "");
var or_this = v.substring(0, v.length - 1);
var and_even_this = v.slice(0, -1);