如何停止spin.js

时间:2013-09-17 19:41:10

标签: jquery jquery-plugins

我在页面上使用spin.js作为微调器。是否有一种方法可以在4转后停止旋转并用文本替换旋转。

任何帮助将不胜感激!

我的代码如下:

<div class="spin">
<div id="spin">
</div> </div>


<script type="text/javascript" src="js/spin2.js"></script>
<script type="text/javascript">
 var opts = {
              lines: 16, // The number of lines to draw 
              length: 0, // The length of each line
              width: 7, // The line thickness
              radius: 37, // The radius of the inner circle
              corners: 1,
              rotate: 0, // The rotation offset
              direction: 1,
              color: '#000', // #rgb or #rrggbb
              speed: 1.6, // Rounds per second
              trail: 100, // Afterglow percentage
              shadow: false, // Whether to render a shadow
              hwaccel: false, // Whether to use hardware acceleration
              className: 'spinner', // The CSS class to assign to the spinner
              zIndex: 2e9, // The z-index (defaults to 2000000000)
              top: 'auto', // Top position relative to parent in px
              left: 'auto' // Left position relative to parent in px
            };
               var target = document.getElementById('spin');
               var spinner = new Spinner(opts).spin(target);

1 个答案:

答案 0 :(得分:1)

$(target).data('spinner').stop();

var spinner = new Spinner();
spinner.stop(target);

$(target).spin(false);