使用javascript spin.js库时出错

使用javascript spin.js库时出错,javascript,asp.net-mvc,Javascript,Asp.net Mvc,我正在使用asp mvc,我需要使用spin.js,但不起作用。这是我正在使用的代码 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>spin.js example</title> <script src="//cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min

我正在使用asp mvc,我需要使用spin.js,但不起作用。这是我正在使用的代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>spin.js example</title>
    <script src="//cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js"></script>
</head>
<body>
    <div id="foo"></div>
    <script>
        var opts = {
            lines: 10, // The number of lines to draw
            length: 7, // The length of each line
            width: 4, // The line thickness
            radius: 10, // The radius of the inner circle
            corners: 1, // Corner roundness (0..1)
            rotate: 0, // The rotation offset
            color: '#000', // #rgb or #rrggbb
            speed: 1, // Rounds per second
            trail: 60, // 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: 25, // Top position relative to parent in px
            left: 25 // Left position relative to parent in px
        };
        var target = document.getElementById('foo');
        var spinner = new Spinner(opts).spin(target);
    </script>
</body>
</html>
信息是

“未定义微调器”


关于如何解决这个问题有什么想法吗?

尝试使用绝对url(使用类似http的方案)



希望这会有所帮助。

使用spin库的完全限定路径,将其插入StackOverflow代码段(完全复制了您的问题,无需额外修改)时,它似乎工作正常。这可能指向代码中的其他问题(这是整个页面),或者浏览器缓存了导致问题的内容


spin.js示例
变量选项={
线条:10,//要绘制的线条数
长度:7,//每行的长度
宽度:4,//线条粗细
半径:10,//内圈的半径
拐角:1,//拐角圆度(0..1)
旋转:0,//旋转偏移量
颜色:'#000'、//#rgb或#rrggbb
速度:1,每秒//圈
轨迹:60,//余辉百分比
shadow:false,//是否渲染阴影
hwaccel:false,//是否使用硬件加速
className:'微调器',//要分配给微调器的CSS类
zIndex:2e9,//z索引(默认为2000000000)
top:25,//在px中相对于父对象的top位置
左:25//在px中相对于父对象的左位置
};
var target=document.getElementById('foo');
var微调器=新微调器(opts)。微调(目标);

我看到spin.min.js下载正确,这个问题非常奇怪,因为我可以在internet上看到示例,它们可以工作,但当我将该代码放入我的应用程序时,它不工作。@user3303841您肯定还有其他问题。确切的代码(src中有http)正在我的机器上运行。@user3303841我能想到的另一件事是,在您进行更改后,浏览器没有完全刷新。点击
CTRL+F5
进行完全刷新
var spinner = new Spinner(opts).spin(target);
<script src="http://cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js"/>