-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script that toggles class of header - task 4
- Loading branch information
1 parent
94ebb55
commit af1a943
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<title>Holberton School</title> | ||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | ||
<style> | ||
.red { | ||
color: #FF0000; | ||
} | ||
|
||
.green { | ||
color: #00FF00; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<header class="green"> | ||
First HTML page | ||
</header> | ||
<div id="toggle_header">Toggle header</div> | ||
<footer> | ||
Holberton School - 2017 | ||
</footer> | ||
<script type="text/javascript" src="4-script.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// script that toggles the class of the <header> element when the user | ||
// clicks on the tag DIV#toggle_header | ||
const $ = window.$; | ||
$('#toggle_header').bind('click', function () { | ||
$('header').toggleClass('green red'); | ||
}); |