繁体   English   中英

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

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

我刚来到blast.js并遇到尝试运行示例的问题 该示例可在Codepen上完美运行,但在本地计算机上无法运行时。 控制台报告以下警告和错误。 非常感谢社区的帮助。

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

错误:{“消息”:“未捕获的TypeError:$(...)。blast不是函数”,
“ filename”:“ https://code.jquery.com/jquery-3.1.1.min.js ”,
“ lineno”:2
“ 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> 

您必须在html中导入javascript库; 在您的代码中,您仅导入了jQuery,但是在CodePen中的javascript设置中,您可以看到

现在您的浏览器期望.blast()是jQuery中定义的函数,但是由于不是这样,您会收到该错误。

暂无
暂无

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

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