Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HW5 Submission for Josh Cooper #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
153 changes: 153 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}


.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}

.clear {
clear: both;
}

.alignright {
float: right;
padding: 0 0 10px 10px;
}

.alignleft {
float: left;
padding: 0 10px 10px 0;
}



body {
color: #000;
font-size: 12px;
line-height: 1.4;
font-family: Helvetica, Arial, sans-serif;
background: url(http://www.siwallpaperhd.com/wp-content/uploads/2015/05/beautiful_paris_city_night_wallpaper_hd_9.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}


.container {
width: 960px;
margin: auto;
padding-top: 5em;
}

header {
background: rgba(0,0,0, .5);
padding: 20px 0;
}

.title {
text-align: center;
color: #fff;
font-size: 38px;
font-weight: bold;
font-family: helvetica, arial, sans-serif;
}

h2 {
text-align: center;
color: #FFF;
font-size: 24px;
font-weight: bold;
font-family: helvetica, arial, sans-serif;
background: rgba(5,5,5,.5);
margin: 40px 0px 0px 0px;
}

.title p {
font-size: 22px;
font-weight: normal
}

#ctemp {
color: #6b6b6c;
font-size: 38px;
background: #fff;
border: 1px solid #111;
padding: 0px 30px;
display: inline-block;
width: 680px;
margin-right: 24px;
font-family: helvetica, arial, sans-serif;
height: 72px;
line-height: 74px;
vertical-align: middle;
box-shadow: #111 0 0 20px;
}

#ftemp {
color: #6b6b6c;
font-size: 38px;
background: #fff;
border: 1px solid #111;
padding: 0px 30px;
display: inline-block;
width: 680px;
margin-right: 24px;
font-family: helvetica, arial, sans-serif;
height: 72px;
line-height: 74px;
vertical-align: middle;
box-shadow: #111 0 0 20px;
}


#submit-btn {
background: #31CC31;
color: #000;
font-size: 38px;
font-weight: bold;
text-transform: uppercase;
border: 1px solid #111;
text-align: center;
display: inline-block;
width: 250px;
height: 72px;
line-height: 74px;
vertical-align: middle;
box-shadow: #111 0 0 50px;
font-family: helvetica, arial, sans-serif;
cursor: pointer;
}
#submit-btn:hover {
background: #3DFF3D;
}

.cold {
background-image: url(http://theartmad.com/wp-content/uploads/2015/04/Snowy-Forest-At-Night-1.jpg)
}
.mild {
background-image: url(http://newtopwallpapers.com/wp-content/uploads/2013/04/Rainy-Night-Desktop-Free-Wallpaper.jpg)
}
.average {
background-image: url(http://cdn.wonderfulengineering.com/wp-content/uploads/2015/05/San-Francisco-Wallpaper-23.jpg)
}
.hot {
background-image: url(http://eskipaper.com/images/hawaii-beach-night-3.jpg)
}







38 changes: 38 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="Your description goes here">
<meta name="keywords" content="one, two, three">
<title>Celsius Converter</title>

<!-- external CSS link -->

<link rel="stylesheet" href="css/styles.css">
</head>

<body>
<header>
<div class="title">
<h1>Celsius Converter</h1>
</div>
</header>
<div class="container">
<form>
<input type="number" id="ctemp" placeholder="Enter your temperature in celsius">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcooper8190 when you have an input with the type of number you get that controller on the right side of the field to increment through number values. Even thought this mitigates you having to change the string value to a number. The final UX is probably not what you would want.

<input type="submit" value="Get Temp" id="submit-btn">
</form>
</div>

<div class="container">
<form>
<input type="number" id="ftemp" placeholder="Displays Fahrenheit">

</form>
</div>


<script src="js/jquery-2.1.4.js"></script>
<script src="js/index.js"></script>
</body>
</html>
59 changes: 59 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
$(function(){

// listen for user clicking 'submit'/submitting text

$("#submit-btn").click(changeBackground);
// $("#submit-btn").click(convertTemp);

function convertTemp() {
// Set the initial variables for c (Celsius) and f (Fahrenheit)
var ctemp = document.getElementById('ctemp'), ftemp = document.getElementById('ftemp');
Copy link

@rmjames rmjames Jun 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcooper8190 if you chose to use one var and comma delimitate the rest of the variables. Try to use this convention.

var ctemp = document.getElementById('ctemp'),
ftemp = document.getElementById('ftemp');

// Test if there is a value for Celsius
if(ctemp.value != '') {
// Set the value for Fahrenheit
ftemp.value = Math.round(ctemp.value * 9 / 5 + 32);
// Clear the value for Celsius
// ctemp.value = '';
// If there isn't a value for Celsius
}
}




function changeBackground(event) {

event.preventDefault();
convertTemp();


var ftemp = parseInt($("#ftemp").val());
console.log(ftemp,(typeof ftemp))



if(ftemp <= 32){
$("body").attr("class", "cold");
}

else if(ftemp > 32 && ftemp < 55){
$("body").attr("class", "mild");
}

else if(ftemp >= 55 && ftemp < 75){
$("body").attr("class", "average");
}

else if(ftemp >= 75){
$("body").attr("class", "hot");
}



else{
$("body").attr("class", "");
}


}
});
Loading