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
15 changes: 11 additions & 4 deletions boxes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<script type="text/javascript" src="boxes.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Boxes!</title>

</head>
<body>
<div id="container">
Expand All @@ -15,10 +16,10 @@
<div class="box boxType1"></div>
</div>
<div id="row2" class="row">
<div class="box boxType2"></div>
<div class="box boxType3"></div>
<div class="box boxType1"></div>
<div class="box boxType2"></div>
<div class="box boxType2">1</div>
<div class="box boxType3">2</div>
<div class="box boxType1">3</div>
<div class="box boxType2">4</div>
</div>
<div id="row3" class="row">
<div class="box boxType3"></div>
Expand All @@ -33,6 +34,12 @@
<div class="box boxType1"></div>
</div>
</div>
<script>
$(function() {
console.log( "ready!" );
});

</script>
</body>

</html>
53 changes: 52 additions & 1 deletion boxes.js
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
console.log("hello world");
$(function() {
console.log("ready!");
$('#secretBox').on('mouseover', function() {
$(this).css({
'background-color': 'white',
'border-bottom': '4px solid orange'
})
}).append('<h1>Secret box!</h1>');
$('#row1 > div').on('mouseover', function() {
$(this).addClass('boxType3')
});
$('#row1 > div:last-child').on('mouseover', function() {
$(this).css({
'display': 'none'
})
});
$('.boxType1').css({
'background-color': 'white',
'border-bottom': '1px solid black'
}).append("<a href='http://www.galvanize.com/'>Click Me</a>")
$('#row2 > div:first-child, #row2 > div:first-child+div').css({
'all': 'initial'
});
// $(" #container > div:not(.row), #container > div:not(#secretBox)").css({'width': '2px'});
$('#container').on('click', function(e) {
console.log(e.pageX + ' , ' + e.pageY);
});
$('.boxType1').on('click', function(e) {
alert("You can never leave the page");
e.preventDefault();
});
$('.box').on('click', function() {
$(this).toggleClass('puppy')
});
$('#container').on('click', function(e) {
if (e.target.id === 'container') {
$(this).css({
'background-color': 'lime'
})
} else {
$(this).css({
'background-color': 'black'
})
$(e.target).css({
'background-color': 'white'
})
}
})
});


// console.log("hello world");
4 changes: 4 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@
.boxType3 {
background: blue;
}

.puppy {
background-image: url(https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRJTJk1vRYIzRaAzigs2A-338F-fi308r2ySl4DqXyzmU56lBSiFPJ9CSw)
}