Medwatch Screen 3
by sk8wt
HTML
<div class="top-bar">
<div class="nav-list">
Medwatch
</div>
</div>
<div class="container">
<div class="fda">
The FDA Safety Information and Adverse Event Reporting Program for Prescription and Over-the-Counter Medications.
</div>
<div class="detailed-info">
Find detailed information on thosands of drugs in our database including drug specs, common reactions, recent issue reports and more.
</div>
<div class="med-question">
Question 3 (of 5): What symptoms are you having that you think might be related to your medication or medications?
</div>
<div class="symptom-box">
<div id="severity">
Slide for severity of symptom.
</div>
<div id="symptom1">
<input type="text" name="symptom" placeholder="Enter first/worst symptom here" size=30>
<section class="slider">
<div id="slider1"></div>
</section>
<!-- <div id="slider1" class="slider"></div>
--> </div>
<div id="symptom2">
<input type="text" name="symptom" placeholder="Enter second symptom here" size=30>
<div id="slider2" class="slider"></div>
</div>
<div id="symptom3">
<input type="text" name="symptom" placeholder="Enter third symptom here" size=30>
<div id="slider3" class="slider"></div>
</div>
</div>
<button class="button">Go to Next Page</button>
</div>
CSS
.top-bar,
.nav-list {
font-family: Proxima Nova, helvetica neue, helvetica, sans-serif;
font-weight: bold;
font-size: 150%;
color: #ffffff;
}
.top-bar {
color: #FFFFFF;
height: 40px;
margin-left: 10px;
}
.nav-list {
list-style-type: none;
padding: 0;
display: inline;
color: #20639B;
}
.container {
padding: 10px;
}
.fda {
margin-bottom: 5%;
font-size: 90%;
}
.detailed-info {
margin-bottom: 5%;
}
.med-question {
font-size: 120%;
font-weight: bold;
}
.symptom-box {
display: grid;
justify-content: center;
}
#severity {
float: right;
margin-right: auto;
padding: 10px;
}
#symptom1 {
margin-top: 30px;
}
.slider label {
position: absolute;
width: 10px;
margin-left: -30px;
text-align: center;
margin-top: 20px;
}
/* below is not necessary, just for style */
.slider {
width: 200px;
margin-bottom: 4em;
margin-left: 30px;
float: right;
padding: 30px;
border-bottom: none;
border-left: none;
border-right: none;
}
.button {
background-color: #e7e7e7;
color: black;
border: none;
padding: 15px 20px;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
float: right;
}
JavaScript
$( ".slider" ).slider({
value: 1,
min: 1,
max: 3,
step: 1,
})
.each(function() {
// Get the options for this slider
var opt = $(this).data().uiSlider.options;
// Get the number of possible values
var vals = opt.max - opt.min;
var labelVals = ["Mild", "Moderate", "Severe"]
// Space out values
for (var i = 0; i <= vals; i++) {
var el = $('<label>'+labelVals[i]+'</label>').css('left',(i/vals*100)+'%');
$( ".slider" ).append(el);
}
});