aterrien / jQuery-Knob

Nice, downward compatible, touchable, jQuery dial
http://anthonyterrien.com/knob/
MIT License
5.03k stars 1.24k forks source link

not a issue but easy way to get in contact with #365

Closed xpectmore closed 4 years ago

xpectmore commented 4 years ago
using your plugin in this way can improve mobile input number form

<div class="py-5 text-center pi-draggable" draggable="true">
    <div class="container">
      <div class="row">
        <div class="col-md-4">
          <input type="text" class="  " data-cursor="true" value="56" onfocus="thisknob(this);">
        </div>
        <div class="col-md-4">
          <input type="text" class="  " data-cursor="true" value="56" onfocus="thisknob(this);">
        </div>
        <div class="col-md-4">
          <input type="text" class="  " data-cursor="true" value="56" onfocus="thisknob(this);">
        </div>
      </div>
    </div>
  </div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"> </script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-Knob/1.2.13/jquery.knob.min.js"> </script> <script>
    var current = null;

    function thisknob(what) {
      target = what;
      if (current != null) resetknob();
      current = $(what).knob({
        min: 0,
        max: 300,
        stopper: true,
        'release': function(v) {
          // console.log('da');
          resetknob();
        }
      });
    }

    function resetknob() {
      value0 = $(current[0]).find('input')[0].value;
      //console.log($(current[0]));
      $(current[0]).parent().html('<input type="text" class="  " data-cursor="true" value="' + value0 + '" onfocus="thisknob(this);" >');
      current = null;
    }
  </script>

ONCE you install this in a html and you open on mobile try to edit then try to edit another element