Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

border-radius for progress bar progress

Tags:

jquery

css

When the bar is not yet to reach 100%, I want to keep the edge without rounded effect.. What I did is use if then change the css of the bar, but it's one step behind.. take a look

http://jsfiddle.net/xjkhH/

you need to hit once more even it reached 100%

$('#test').on('click', function (e) {
    $progress_bar = $('#progressbarr');

    //convert to percent
    var progressbar_width;


    progressbar_width = Math.floor(100 * ($progress_bar.find('div').width()) / $progress_bar.width());

    var i = progressbar_width + 10; // change in percent

    if (i < 101) {


        $progress_bar.find('div').css('width', (i + '%'));

        $progress_bar.find('span').text(i + '%');


    } else {
        $progress_bar.find('div').css('border-top-right-radius', '4px');
        $progress_bar.find('div').css('border-bottom-right-radius', '4px');

    }

});
like image 667
Ulises Colen Avatar asked Dec 25 '22 20:12

Ulises Colen


1 Answers

Keep it simple This is all you need (CSS):

overflow:hidden;

for your #progressbarr :)

DEMO

like image 186
Roko C. Buljan Avatar answered Jan 09 '23 07:01

Roko C. Buljan