diff --git a/boxes.js b/boxes.js index 6b2b3db..b43ab96 100644 --- a/boxes.js +++ b/boxes.js @@ -1 +1,46 @@ -console.log("hello world"); +$( document ).ready(function() { + alert("Ready for DOM manipulation."); +}); +$(function() { + alert("Ready for DOM manipulation."); + $("#secretBox").css({'background': 'white'}); + + var $div = $('
', { + 'id':'secretBox' + }).appendTo('#secretBox'); + $("

").text("secret box!").appendTo($div); + + $("#row1").addClass("boxType3"); + + $("#row4 :last-child").hide(); + + $(".boxType1").css({'background': 'white'}); + + $("#row2 :nth-child(-n+2)").css({'background': 'transparent'}); + + $('.box:not(div#secretBox)').width('2px') + + $("#container").on('click', function(e) { + console.log(e.pageX, e.pageY); + }); + + $(".boxType1").on('click', function() { + $(".boxType1").wrap(''); + alert("You can never leave this page!"); + event.preventDefault(); + }); + + $('.box').on('click', function() { + $(this).css({'background-image': 'url(https://pbs.twimg.com/profile_images/562466745340817408/_nIu8KHX.jpeg)'}); + }) + + $(function(){ + $('#container').on('click', function(event){ + $(this).css({'background-color': 'black'}) + $(event.target).css({'background-color': 'white'}) + if (event.target == this) { + $(this).css({'background-color': 'rgb(50, 255, 46)'}) + } + }) + }) +});