jquery-circle-progress icon indicating copy to clipboard operation
jquery-circle-progress copied to clipboard

Text in the middle of the circle

Open robssonpeter opened this issue 5 years ago • 5 comments

How do I write the percentage of progress in the middle of the circle?

robssonpeter avatar Dec 15 '20 10:12 robssonpeter

Play with css:

                    .circle {
                        position: relative;

                        strong {
                            position: absolute;
                            transform: translate(-50%,-50%);
                            top: 50%;
                            left: 50%;
                        }
                    }

artik avatar Apr 26 '21 08:04 artik

@artik that is not valid css...

Silloky avatar Aug 24 '23 05:08 Silloky

@robssonpeter I had the same question; I looked around on the preview page and found this link : http://kottenator.github.io/jquery-circle-progress/examples.js

It details how each of the examples on the page work.

According to example 2 :

$('.second.circle').circleProgress({
    value: 0.6
}).on('circle-animation-progress', function(event, progress) {
    $(this).find('strong').html(Math.round(100 * progress) + '<i>%</i>');
});

This shows that the plugin doesn't natively set the inner text, but does create a text field for you to go and put whatever you want in there. The plugin fires an event on the canvas' parent, which can be used to trigger, in your case, a text change in the middle.

Hope this helps

Silloky avatar Aug 24 '23 05:08 Silloky

Oh, didn't realise this issue was so old...

Silloky avatar Aug 24 '23 05:08 Silloky

@robssonpeter I had the same question; I looked around on the preview page and found this link : http://kottenator.github.io/jquery-circle-progress/examples.js

It details how each of the examples on the page work.

According to example 2 :

$('.second.circle').circleProgress({
    value: 0.6
}).on('circle-animation-progress', function(event, progress) {
    $(this).find('strong').html(Math.round(100 * progress) + '<i>%</i>');
});

This shows that the plugin doesn't natively set the inner text, but does create a text field for you to go and put whatever you want in there. The plugin fires an event on the canvas' parent, which can be used to trigger, in your case, a text change in the middle.

Hope this helps

This does not seem to put text in the middle of it. Any fix? Thank you

vitoff34 avatar Oct 07 '23 14:10 vitoff34