From 718392691c63f7130aa84e1ea0cfe3bfe0dfc481 Mon Sep 17 00:00:00 2001 From: Joshua King Date: Mon, 12 Sep 2016 19:51:33 -0400 Subject: [PATCH] Completed Week 3 JS Challenge --- Challenges/Week3/index.html | 8 ++++---- Challenges/Week3/js/app.js | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Challenges/Week3/index.html b/Challenges/Week3/index.html index 2ee5d5a..7f568d9 100644 --- a/Challenges/Week3/index.html +++ b/Challenges/Week3/index.html @@ -13,7 +13,7 @@

Flash Cards

  • Q: What TV show featured the fictional "The Cobra Lodge" fraternity? - A: Mama's Family + A: Mama's Family
  • Q: What album earned the Dixie Chicks a Grammy Award in 2007? @@ -25,7 +25,7 @@

    Flash Cards

  • Q: An episode of what sitcom spawned the phrase "jumped the shark"? - A: Happy Days + A: Happy Days
  • Q: Who was the first female comic to be called over to the couch by Johnny Carson? @@ -33,7 +33,7 @@

    Flash Cards

  • Q: What famous rapper's real name is Chris Bridges? - A: Ludacris + A: Ludacris
  • Q: In which country was the singer Mika born? @@ -43,7 +43,7 @@

    Flash Cards

    - + \ No newline at end of file diff --git a/Challenges/Week3/js/app.js b/Challenges/Week3/js/app.js index 432dc9b..690f3c0 100644 --- a/Challenges/Week3/js/app.js +++ b/Challenges/Week3/js/app.js @@ -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. */ -$() \ No newline at end of file +$('.cheat-button').click(function(){ + $('.answer').show(); +}); \ No newline at end of file