-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfahrenheit.html
More file actions
44 lines (42 loc) · 1.79 KB
/
fahrenheit.html
File metadata and controls
44 lines (42 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!doctype html>
<html>
<head>
<title>Equation!</title>
<style type="text/css">
body {margin: 0px; background: rgb(20, 20, 20); }
</style>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<!-- Sample to be usable, when embedded directly -->
<div id="calculator-preview">
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/equation.css" />
<div class="equation-container">
<h3>Convert Fahrenheit to Celsius</h3>
<p class="guff">Convert degrees from Fahrenheit to Celsius. An example calculator for equation.</p>
<div class="calculator">
<div class="var-input-wrapper">
<label>Degrees Fahrenheit</label>
<input type="text" placeholder="0" class="variable-input" id="variable-input-fahrenheit" />
</div>
<div class="calc-results cf">
<button id="calculate-button">Calculate</button>
<div class="result-label">Degrees Celsius: <span id="result"></span></div>
</div>
</div>
<script type="text/javascript">
function calculate(){
var fahrenheit = +$('#variable-input-fahrenheit').val() || 0;
$('#result').text(((fahrenheit-32)/1.8).toFixed(1));
$('.result-label').fadeIn();
}
$('#calculate-button').click(function(){
calculate();
$('.variable-input').keyup(calculate);
});
</script>
</div>
</div>
</body>
</html>