2017-07-29 9 views
0

我正在通過freecodecamp工作,並在他們告訴你的jQuery部分。將Animate.css庫添加到我的文檔中?

「我們已經在後臺包含了jQuery庫和Animate.css庫,以便您可以在編輯器中使用它們。

到目前爲止,我一直在完成練習,然後跳入記事本++和試驗代碼,直到我對自己的工作充滿信心。

我已經加入到我的記事本++文件

<script 
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> 
</script> 

<link rel="stylesheet" href="css/animate.css"> 

和外部的我已經

<script> 
$(document).ready(function() { 

$("button").addClass("animated bounce"); 

}); 
</script> 

有我添加了jQuery & Animate.css圖書館是否正確? 我創建的按鈕沒有反彈,因爲它們在freecodecamp 控制檯中。

回答

2

如果您已複製此代碼,那麼CSS文件的路徑可能不正確。您正在從本地文件系統訪問它。你需要給實際文件提供完整的路徑。 在這裏,你可以使用CDN

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.css"> 
+0

完美工作了魅力!好一個。 –

1

嘗試在我的片段此其工作的罰款。你有沒有錯過jQuery class或類似的東西?如果你使用的是class,你應該使用.yourclass,如果它的ID是jQuery中的#yourclass。因此,檢查你的code.Ty

$(document).ready(function() { 
 

 
    $("button").addClass("animated bounce"); 
 

 
});
button { 
 
    padding: 10px; 
 
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.css"> 
 

 
<button>HI its me</button> 
 

 

 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> 
 
</script>

+0

這是不正確的感謝很多文件路徑。 –