问题描述
我在网页中使用了typed.js,jQuery和google-fonts。我已经使用npm安装了它们。但是问题是我无法弄清楚要导入哪些文件才能使它们工作。这就是我导入这些文件但不起作用的方式。
jQuery as
<script type="text/javascript" src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
typed.js为
<script type="text/javascript" src="node_modules/typed.js/src/typed.js"></script>
在浏览器的控制台面板中显示
Uncaught ReferenceError: Typed is not defined
<anonymous> http://localhost:1234/:168
localhost:1234:168:13
Uncaught ReferenceError: jQuery is not defined
<anonymous> http://localhost:1234/:175
当我对每个CDN都使用CDN时,一切都完美无误
这是typed.js的使用
<h1 id="h1"><span class="type"></span></h1>
<script>
var typed = new Typed('.type',{
strings: ['<span class="text-primary">....</span>','<span class="text-success">....</span>',],loop: true,backSpeed: 50,typeSpeed: 125,});
</script>
使用jQuery
<h3 class="quotes">....</h3>
<h3 class="quotes">....</h3>
<script>
(jQuery(document).ready(function($) {
var quotes = $("h3");
var quoteIndex = 0;
var color = 509 ;
function showNextQuote() {
++quoteIndex;
//alert(quoteIndex);
var x = quotes.eq(quoteIndex % quotes.length);
//console.log(x);
var newcolor = color * Math.random(1999) ;
x.css("color","#" + newcolor).fadeIn(600)
.delay(750)
.fadeOut(600,showNextQuote);
}
showNextQuote();
}));
</script>
在使用谷歌字体的情况下,我找不到要从node_modules导入的单个CSS文件。 还有放置这些文件链接的正确位置是什么
如果您能提供帮助,我会很高兴
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)