javascript - Make knob load after AJAX success -
i knob animated right after ajax call done. number, knob should progress
without refresh. want is: ajax request succesfull -> sends number knob function -> knob fill up.
code:
.. success: function(data) { knobload(data); } .. function knobload(data) { $('.knob').each(function () { var $this = $(this); $this.knob({ }); $({ value: 0 }).animate({ value: data }, { duration: 2000, easing: 'swing', step: function () { $this.val(math.ceil(this.value)).trigger('change'); } }) }); } </script> <input class="knob animated" value="0" readonly data-width="80%">
ended adding knob inside file ajax requests, , display afterwards.
$.ajax({ url: 'ajax.php', data: { id: id }, success: function(data) { $('#knob').html(data); } });
the ajax file:
$('.knob').each(function () { var $this = $(this); $this.knob({ }); $({ value: 0 }).animate({ value: data }, { duration: 2000, easing: 'swing', step: function () { $this.val(math.ceil(this.value)).trigger('change'); } }) }); </script> <input class="knob animated" value="0" readonly data-width="80%">
Comments
Post a Comment