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..c6cfc5a 100644 --- a/boxes.js +++ b/boxes.js @@ -1 +1,40 @@ -console.log("hello world"); +// Exercise 2 + +$('#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"); +$(''); +// 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"); + } +});