It is necessary when vmousedown , so that the height of the block increases, while vmouseup stops growing. This is implemented by me so
var intervalTimer1 = 0; $(document).on("vmousedown", "#btn", function() { var rost = 0; intervalTimer1 = setInterval(function() { rost++; console.log("rost =" + rost); $('#planka').css("height", rost + "px"); }); }); $(document).on("vmouseup", "#btn", function() { clearInterval(intervalTimer1); intervalTimer1 = 0; }); Everything works, but not quite smoothly, sometimes it jerks. Using the animate method animate better, but still, sometimes with jerking, it is better to optimize it.
animation-play-stateadded and then the height will remain current, but the maximum height will be limited, does that suit you? - Mr_Epicvar rost = 0;Take out of the function, you are twitching because growth always starts from scratch. - Jean-Claude