Created
February 24, 2017 02:21
-
-
Save Maighdlyn/7a1fc9afc390528e4c1e410cfe7ca202 to your computer and use it in GitHub Desktop.
Color Picker
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
<body> | |
<h1>Color Picker</h1> | |
<h3>Background Color Selector</h3> | |
<p>To select a background color, please click on your prefered color below:</p> | |
<div> | |
<button class="red"></button> | |
<button class="orange"></button> | |
<button class="yellow"></button> | |
<button class="green"></button> | |
<button class="blue"></button> | |
<button class="purple"></button> | |
<button class="grey"></button> | |
<button class="white"></button> | |
</div> | |
</body> |
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
$(document).ready(function() { | |
$('button').addClass('buttonClass'); | |
$('button').click(function() { | |
$('body').removeClass(); | |
var color = $(this).attr('class'); | |
$('body').addClass(color); | |
}); | |
}); |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> |
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
.buttonClass { | |
border-radius: 20px; | |
padding: 20px; | |
margin: 5px; | |
} | |
.red { | |
background-color: FireBrick; | |
} | |
.orange { | |
background-color: orange; | |
} | |
.yellow { | |
background-color: yellow; | |
} | |
.green { | |
background-color: green; | |
} | |
.blue { | |
background-color: DeepSkyBlue; | |
} | |
.purple { | |
background-color: RebeccaPurple; | |
} | |
.grey { | |
background-color: grey; | |
} | |
.white { | |
background-color: white; | |
} |
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
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment