From 35e6d6e358dce698ff2617c0f41c2d36e418c191 Mon Sep 17 00:00:00 2001 From: Murph Grainger Date: Wed, 2 Nov 2016 16:57:58 -0600 Subject: [PATCH 1/2] finished through Exercise 2 --- boxes.html | 73 +++++++++++++++++++++++++++++------------------------- boxes.js | 9 +++++++ 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/boxes.html b/boxes.html index 44586a8..e19d5ec 100644 --- a/boxes.html +++ b/boxes.html @@ -1,38 +1,43 @@ - - - - - Boxes! - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- + + + + + + Boxes! + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ diff --git a/boxes.js b/boxes.js index 6b2b3db..61784d3 100644 --- a/boxes.js +++ b/boxes.js @@ -1 +1,10 @@ console.log("hello world"); + +$('#secretBox').append('

secret box!

'); +$('#row1').children().addClass('boxType3'); +$('#row4 > div:last-child').hide(); +$('div.box.boxType1').css('backgound-color', 'white'); +$('#row2 > div:lt(2)').removeAttr('style'); +$('#row2 > div:lt(2)').removeAttr('class'); +$('.box').not(document.getElementById("secretBox")) + .css("width", "2px"); From cd42fa22d0c9728892c2a11ac91c16d0953a21d3 Mon Sep 17 00:00:00 2001 From: Murph Grainger Date: Wed, 2 Nov 2016 17:38:57 -0600 Subject: [PATCH 2/2] finished all three exercises --- boxes.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/boxes.js b/boxes.js index 61784d3..c6cfc5a 100644 --- a/boxes.js +++ b/boxes.js @@ -1,4 +1,4 @@ -console.log("hello world"); +// Exercise 2 $('#secretBox').append('

secret box!

'); $('#row1').children().addClass('boxType3'); @@ -8,3 +8,33 @@ $('#row2 > div:lt(2)').removeAttr('style'); $('#row2 > div:lt(2)').removeAttr('class'); $('.box').not(document.getElementById("secretBox")) .css("width", "2px"); +$(''); +// Exercise 3 +// 1. +$('#container').click(function(event) { + console.log("X: " + event.pageX + " Y: " + event.pageY); +}); + +// 2. +$('div.box.boxType1').append('Galvanize').click(function(event) { + alert("You can never leave the page."); + event.preventDefault(); +}); + +// 3. +$('.box').click(function(event) { + $('.box').append(''); +}); +$('.box').click(function(event) { + $('.box').empty(); +}); + +//4. +$("#container").click(function(event) { + if ($(event.target).is($(this))) { + $(this).css("background-color", "limegreen"); + } else { + $(event.target).css("background-color", "white"); + $(this).css("background-color", "black"); + } +});