我正在使用一個插件Typed.js 當我初始化函數時會彈出錯誤提示。它建議在插件之前不加載jquery,但我不明白爲什麼。
HTML
<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="typed.js"></script>
在頭中。
而且
<script>
function type(){
$("#type").typed({
strings: ["^1000to the biggest student organised fest in Kanpur", "to the biggest student organised fest in UP", "to the biggest student organised fest in <span style='color: #ffee00'>India</span> ^800."],
typeSpeed: 10,
stringstops: [41, 41, 41],
backDelay: 600,
showCursor: true,
loop: false,
contentType: 'html', // or text
// defaults to false for infinite loop
loopCount: false,
});
}
window.onload=type;
</script>
在身體的末端。
有人可以找到錯誤嗎?
此處的代碼與錯誤消息不符。 '$(「#type」)。typed()'vs.'$(「#typed」)。typed()' – panther
是的,但這是故意的。我修改了錯誤消息,因爲#type是我的id,而在插件示例中使用了#typed,大多數人都會將其作爲問題進行搜索。 – Rishi