-
-
Notifications
You must be signed in to change notification settings - Fork 286
London | 26-ITP-May | Raihan Sharif | Sprint 3 | Quote Generator #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -491,3 +491,16 @@ const quotes = [ | |
| ]; | ||
|
|
||
| // call pickFromArray with the quotes array to check you get a random quote | ||
|
|
||
| const quoteText = document.getElementById("quote"); | ||
| const authorText = document.getElementById("author"); | ||
|
|
||
| const newQuoteBtn = document.getElementById("new-quote"); | ||
|
|
||
| newQuoteBtn.addEventListener("click", () => { | ||
| const selectedQuote = pickFromArray(quotes); | ||
| quoteText.textContent = selectedQuote.quote; | ||
| authorText.textContent = `-- ${selectedQuote.author}`; | ||
| }); | ||
|
|
||
| document.onload = newQuoteBtn.click(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why assign the return value of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. meant to do Now uses function to generate quote and calls that instead. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| /** Write your CSS in here **/ | ||
| #author { | ||
| font-style: italic; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The leading
--appears to be for styling purposes. Keeping it in the CSS or in HTML could allow us to adjust the view without changing any JavaScript code.