简体   繁体   English

blast.js示例可在代码笔上完美运行,但不能在本地运行

[英]blast.js example works perfectly on code pen but not locally

I have just came accross blast.js and facing problem trying to run an example . 我刚来到blast.js并遇到尝试运行示例的问题 The example works perfectly on codepen, but when doesn't work on my machine locally. 该示例可在Codepen上完美运行,但在本地计算机上无法运行时。 The console reports following warning, and error. 控制台报告以下警告和错误。 Would really appreciate the help of community. 非常感谢社区的帮助。

Warning: jQuery.Deferred exception: $(...).blast is not a function TypeError: $(...).blast is not a function 警告:jQuery.Deferred异常:$(...)。blast不是函数TypeError:$(...)。blast不是函数
at HTMLDocument. 在HTMLDocument。 ( http://stacksnippets.net/js:24:6 ) http://stacksnippets.net/js:24:6
at j ( https://code.jquery.com/jquery-3.1.1.min.js:2:29948 ) 在j( https://code.jquery.com/jquery-3.1.1.min.js:2:29948
at k ( https://code.jquery.com/jquery-3.1.1.min.js:2:30262 ) undefined 在k( https://code.jquery.com/jquery-3.1.1.min.js:2:30262 )未定义

Error: { "message": "Uncaught TypeError: $(...).blast is not a function", 错误:{“消息”:“未捕获的TypeError:$(...)。blast不是函数”,
"filename": " https://code.jquery.com/jquery-3.1.1.min.js ", “ filename”:“ https://code.jquery.com/jquery-3.1.1.min.js ”,
"lineno": 2, “ lineno”:2
"colno": 31635 “ colno”:31635
} }

 /* jquery.js */ /* jquery.velocity.js */ /* velocity.ui.js */ /* jquery.blast.js */ $(document).ready(function() { $("div") // Blast the text apart by word. .blast({ delimiter: "word" }); }); 
 <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> <div> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do. Eiusmod tempor incididunt ut labore et dolore magna aliqu. </div> 

You have to import the javascript libraries in your html; 您必须在html中导入javascript库; in your code you only have jQuery imported, but in CodePen, in the javascript settings, you can see 在您的代码中,您仅导入了jQuery,但是在CodePen中的javascript设置中,您可以看到

Now your browser expects .blast() to be a function defined in jQuery, but since it's not you get that error. 现在您的浏览器期望.blast()是jQuery中定义的函数,但是由于不是这样,您会收到该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM