+ 3

Guys how can i change the color of box by sliding Scroll bar? [JavaScript]

actually i made this but it is not working evenly. 1)the color should increases on sliding the scroll bar and the color should be removed latterly on sliding backward How can i do this please tell me what is the problem in my Programming with giving the right why to do that. https://code.sololearn.com/Wqf9ai4lavYs/?ref=app

13th Apr 2018, 8:30 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
1 Antwort
+ 4
Put this in the script tag instead window.setInterval(function(){ var move=document.getElementById('range').value;//get the values form slider!!!!! var a=document.getElementById('box'); a.style.background="rgb("+(move*2.55)+",0,0)";//to change the color. }, 100);
13th Apr 2018, 11:23 AM
Ariela
Ariela - avatar