Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/470.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何更改圆的大小?_Javascript_Html_Css_Web - Fatal编程技术网

Javascript 如何更改圆的大小?

Javascript 如何更改圆的大小?,javascript,html,css,web,Javascript,Html,Css,Web,我看到一个代码,我试图修改圆圈的大小,但我不知道我可以使用js或css更改它。有什么方法可以更改它吗? 完整代码来自: hesr是js代码: /** * index.js * - All our useful JS goes here, awesome! Maruf-Al Bashir Reza */ console.log("JavaScript is amazing!"); $(document).ready(function($) { function animateEle

我看到一个代码,我试图修改圆圈的大小,但我不知道我可以使用js或css更改它。有什么方法可以更改它吗?

完整代码来自:

hesr是js代码:

/**
 * index.js
 * - All our useful JS goes here, awesome!
 Maruf-Al Bashir Reza
 */

console.log("JavaScript is amazing!");
$(document).ready(function($) {
  function animateElements() {
    $('.progressbar').each(function() {
      var elementPos = $(this).offset().top;
      var topOfWindow = $(window).scrollTop();
      var percent = $(this).find('.circle').attr('data-percent');
      var percentage = parseInt(percent, 10) / parseInt(100, 10);
      var animate = $(this).data('animate');
      if (elementPos < topOfWindow + $(window).height() - 30 && !animate) {
        $(this).data('animate', true);
        $(this).find('.circle').circleProgress({
          startAngle: -Math.PI / 2,
          value: percent / 100,
          thickness: 14,
          fill: {
            color: '#1B58B8'
          }
        }).on('circle-animation-progress', function(event, progress, stepValue) {
          $(this).find('div').text((stepValue * 100).toFixed(1) + "%");
        }).stop();
      }
    });
  }

  // Show animated elements
  animateElements();
  $(window).scroll(animateElements);
});
/**
*index.js
*-我们所有有用的JS都在这里,太棒了!
马鲁夫·巴希尔·雷扎
*/
log(“JavaScript太棒了!”);
$(文档).ready(函数($){
函数animateeelements(){
$('.progressbar')。每个(函数(){
var elementPos=$(this).offset().top;
var topOfWindow=$(window.scrollTop();
变量百分比=$(this.find('.circle').attr('data-percent');
var百分比=parseInt(百分比,10)/parseInt(100,10);
var animate=$(this.data('animate');
if(elementPos
它似乎被用作依赖项。因此,要更改圆的大小,需要添加默认为100的
size
属性:

    $(this).find('.circle').circleProgress({
      startAngle: -Math.PI / 2,
      value: percent / 100,
      thickness: 14,
      fill: {
        color: '#1B58B8'
      },
      size: 300 // <-- here, the size changes the circle radius
    })
因此,完整示例如下所示:

/**
*index.js
*-我们所有有用的JS都在这里,太棒了!
马鲁夫·巴希尔·雷扎
*/
log(“JavaScript太棒了!”);
$(文档).ready(函数($){
函数animateeelements(){
$('.progressbar')。每个(函数(){
var elementPos=$(this).offset().top;
var topOfWindow=$(window.scrollTop();
变量百分比=$(this.find('.circle').attr('data-percent');
var百分比=parseInt(百分比,10)/parseInt(100,10);
var animate=$(this.data('animate');
if(elementPos
/**
*index.scss
*-在此处添加您想要的任何样式!
*/
身体{
背景:#f5;
}
.progressbar{
显示:内联块;
宽度:300px;
利润率:25px;
}
.圆圈{
宽度:100%;
保证金:0自动;
边缘顶部:10px;
显示:内联块;
位置:相对位置;
文本对齐:居中;
}
.圆形帆布{
垂直对齐:中间对齐;
}
.圆形分区{
位置:绝对位置;
顶部:30px;
左:0;
宽度:100%;
文本对齐:居中;
线高:40px;
字体大小:20px;
}
.圈强i{
字体风格:普通;
字号:0.6em;
字体大小:正常;
}
.圆跨度{
显示:块;
颜色:#aaa;
边缘顶部:12px;
}

我的新钢笔!
滚动时圈出进度条
↓ 向下滚动↓
标题(占位符)
测试

测试

测试

测试


你指的那4个圆圈的厚度是多少?
.progressbar {
  display: inline-block;
  width: 300px;
  margin: 25px;
}