あなたはデバウンス機能が必要になります。どちらか使用lodash _.debounceまたはあなた自身の簡単なものを書く。そして、このようにそれを使用します。
jQuery("#width").on('input', debounce(function() {
alert('hello')
}, 1500))
シンプルなデバウンス機能は次のようになります:
jQuery("#width").on('input', debounce(function() {
alert('hello');
}, 1500));
function debounce(callback, delay) {
var timeout
return function() {
var args = arguments
clearTimeout(timeout)
timeout = setTimeout(function() {
callback.apply(this, args)
}.bind(this), delay)
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="width" />
グレート男ありがとうA:ここで
はデモですロット。 :) – MageLerner