mardi 15 décembre 2020

Range Slider with labeling

Hey I want to Slider like this one Slider with labels

I found some code to get a similar slider My slider so far but I'm really bad with HTML/CSS/Javascript I just need that one thing coded for my Website, could someone help me? That's the code for my current slider

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.slidecontainer {
  width: 100%;
}
 
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 25px;
  background: #d3d3d3;
  outline: none;
  opacity: 0.7;
  -webkit-transition: .2s;
  transition: opacity .2s;
}
 
.slider:hover {
  opacity: 1;
}
 
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 25px;
  height: 25px;
  background: #44cddd;
  cursor: pointer;
}
 
.slider::-moz-range-thumb {
  width: 25px;
  height: 25px;
  background: #4CAF50;
  cursor: pointer;
}
</style>
</head>
<body>
<div style="text-align:center">
<h1 style="font-family:Montserrat,sans-serif">Rechner</h1>
</div>
<p style="font-family=Montserrat,sans-serif">X</p>
 
<div class="slidecontainer">
  <input type="range" min="1" max="10" value="1" class="slider" id="myRange">
  <p>Y <span id="demo"></span>€</p>
</div>
 
<script>
var slider = document.getElementById("myRange");
var output = document.getElementById("demo");
output.innerHTML = slider.value*100;
 
slider.oninput = function() {
  output.innerHTML = this.value*100;
}
</script>
 
</body>
</html>



Aucun commentaire:

Enregistrer un commentaire