Site Notice

hello, world

Difference between revisions of "Svg loading"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
([InPageEdit] 没有编辑摘要)
Line 11: Line 11:
 
<pre>
 
<pre>
 
$('.spinner circle').each(function(){
 
$('.spinner circle').each(function(){
  var $this = $(this),
 
      $class = $this.attr('class'),
 
      dash = $this.attr('stroke-dasharray'),
 
      dash1 = dash.split(' ')[0];
 
 
   setInterval(function(){
 
   setInterval(function(){
     if (dash1>126 || ) {
+
    var $this = $('.spinner circle'),
       doMinus()
+
        $class = $this.attr('class'),
     } else if (dash < 0) {
+
        dash = $this.attr('stroke-dasharray'),
       doPlus()
+
        dash1 = Number(dash.split(' ')[0]),
 +
        dash2;
 +
     if (dash1 > 126) {
 +
       $this.attr('class','doMinus');
 +
     } else if (dash1 < 10) {
 +
      $this.attr('class','doPlus');
 +
    }
 +
    if ($this.hasClass('doMinus')) {
 +
       dash2 = dash1 - 2;
 +
      $this.attr('stroke-dasharray',dash2+' 1000');
 +
    } else if ($this.hasClass('doPlus')) {
 +
      dash2 = dash1 + 2;
 +
      $this.attr('stroke-dasharray',dash2+' 1000');       
 
     }
 
     }
 
   },100);
 
   },100);
 
});
 
});
 
</pre>
 
</pre>

Revision as of 01:05, 3 December 2019

<html> <div class="spinner-block"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="spinner" width="52px" height="52px"> <g id="group" style="" transform="translate(26,26)"> <circle class="doMinus" r="20" stroke="black" stroke-width="6" stroke-dasharray="126 1000" fill="transparent" style="transform: rotate(0deg);" cx="0" cy="0"></circle> </g> </svg> </div> </html>

$('.spinner circle').each(function(){
  setInterval(function(){
    var $this = $('.spinner circle'),
        $class = $this.attr('class'),
        dash = $this.attr('stroke-dasharray'),
        dash1 = Number(dash.split(' ')[0]),
        dash2;
    if (dash1 > 126) {
      $this.attr('class','doMinus');
    } else if (dash1 < 10) {
      $this.attr('class','doPlus');
    }
    if ($this.hasClass('doMinus')) {
      dash2 = dash1 - 2;
      $this.attr('stroke-dasharray',dash2+' 1000');
    } else if ($this.hasClass('doPlus')) {
      dash2 = dash1 + 2;
      $this.attr('stroke-dasharray',dash2+' 1000');         
    }
  },100);
});