Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Challenges/Week3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>Flash Cards</h1>
</li>
<li class="flash-card">
<span class="question">Q: What TV show featured the fictional "The Cobra Lodge" fraternity?</span>
<span class="answer">A: Mama's Family</spanp>
<span class="answer">A: Mama's Family</span>
</li>
<li class="flash-card">
<span class="question">Q: What album earned the Dixie Chicks a Grammy Award in 2007?</span>
Expand All @@ -25,15 +25,15 @@ <h1>Flash Cards</h1>
</li>
<li class="flash-card">
<span class="question">Q: An episode of what sitcom spawned the phrase "jumped the shark"?</span>
<span class="answer">A: Happy Days</spanp>
<span class="answer">A: Happy Days</span>
</li>
<li class="flash-card">
<span class="question">Q: Who was the first female comic to be called over to the couch by Johnny Carson?</span>
<span class="answer">A: Ellen DeGeneres</span>
</li>
<li class="flash-card">
<span class="question">Q: What famous rapper's real name is Chris Bridges?</span>
<span class="answer">A: Ludacris</spanp>
<span class="answer">A: Ludacris</span>
</li>
<li class="flash-card">
<span class="question">Q: In which country was the singer Mika born?</span>
Expand All @@ -43,7 +43,7 @@ <h1>Flash Cards</h1>

<button class="cheat-button">Show All Answers</button>

<!--Replace this comment with a script tag from https://code.jquery.com/ -->
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js" integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E=" crossorigin="anonymous"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
12 changes: 9 additions & 3 deletions Challenges/Week3/js/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
// 1.) Make sure you have a reference to jQuery from a CDN in the index.html file.

// 2.) Use a jQuery to hide all of the answers to all the questions.
$('.answer')
$('.answer').hide();

/* 3.) Write code to show the answer when hovering over a flash card, and hide it when the mouse leaves.
Find the approriate event on the jQuery API page to trigger an action on hover https://api.jquery.com/category/events/
Hint: You can use "this" inside your jQuery function to reference a selected DOM node. */
$('.flash-card')
$('.flash-card').hover(function(){
$(this).find('.answer').show();
}, function(){
$(this).find('.answer').hide();
});

/* 4.) Use jQuery to find the button element on the page and have it toggle all of the answers on and off when clicked.
Hint: jQuery has a toggle function that can toggle the visibility of a selected DOM node.
Bonus: Change the text of the button using jQuery when you toggle the answers on/off. */
$()
$('.cheat-button').click(function(){
$('.answer').show();
});