Change properties with a range slider

0

Hi, I would like to know how I can change the size of a div gradually with a range slider.

Thank you very much.

    
asked by Anonimo 06.04.2018 в 18:39
source

1 answer

1

var range = document.getElementById("my-range");
var square = document.getElementById("square");

range.addEventListener("change", function() {
  square.style.zoom = this.value;
});
#square {
  margin: 20px;
  background: red;
  width: 50px;
  height: 50px;
}
<input id="my-range" type="range" step="0.25" min="0.25" max="4" />

<div id="square"></div>

credits

    
answered by 06.04.2018 в 18:47