seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

OnInput range slider on webpage how to get values as previous and latest values #936

Closed droidbreaker closed 4 years ago

droidbreaker commented 4 years ago

Here is my Code:

client.println("

LEDwhite: <span id=\"brightnessWhite\">

");
client.println("<input type=\"range\" min=\"250\" max=\"1023\" step=\"38.65\" class=\"slider\" id=\"brightLEDW\" oninput=\"LED1(this.value)\" value=\""+valueString+"\"/>");

        client.println("<script>var slider = document.getElementById(\"brightLEDW\");");
        client.println("var brightLW = document.getElementById(\"brightLvl\"); brightLW.innerHTML = slider.value;");
        client.println("slider.oninput = function() { slider.value = this.value; brightLW.innerHTML = this.value; }");
        client.println("$.ajaxSetup({timeout:1000}); function LED1(pos1) { ");
        client.println("$.get(\"/?value=\" + pos1 + \"&\"); {Connection: close};}</script>");

if(header.indexOf("GET /?value=")>=0) { lvl1 = header.indexOf('='); lvl2 = header.indexOf('&'); valueString = header.substring(lvl1+1, lvl2);

          val1 = valueString.toInt();
          analogWrite(LED1pin,val1);             // always write analog vlue 0-1023 range

        }

i am using in Arduino IDE for ESP-8266 wifi module for webpage interface

I just need to take two adjecent values and then i will be taking average of those two values which will previous and latest values so how can i store these two values in variables i mean how can i get values here i am getting updated values every time as latest value. how can i get previous value how can i store previous value in variable please guide me thank you!

seiyria commented 4 years ago

You will need to provide a jsfiddle for us to look at anything. From what I understand though, if you watch for the change event you can get the previous value: https://github.com/seiyria/bootstrap-slider#events

droidbreaker commented 4 years ago

@seiyria thank you sir i will be try to post jsfiddle format