等待“調整大小”事件的'end'事件的'end'ext'execution
'suse jusize'size'size'size'size 聲明一個變量,'doit',並將其初始化為'null'。 This variable will hold the timeout id returned by 'setTimeout()'.
var doit = null;Attach the event listener to the 'onresize' event of the 'window' object.window.onresize = function() {
Use 'clearTimeout()' to cancel any pending timeout request associated with the 'doit'變量。將'settimeout()''的結果分配給'doit'變量。這將在延遲100毫秒後安排“ resizizew()”的執行。
doit = settimeout(rasizeizew,100); };當調整大小操作結束時,將調用'onResize'事件處理程序,而不會立即觸發'resizizedw()'。 After the designated delay (100 milliseconds), 'resizedw()' will execute, marking the completion of the resizing process.
Example Code:
function resizedw() { // Your action to be performed when resizing finishes }The following code demonstrates the implementation of this approach:function resizedw() { //調整完成大小時要執行的操作 console.log('調整完成!'); } var doit = null; window.sonresize = function(){ ClearTimeOut(DOIT); doit = settimeout(justizedw,100); };
var doit = null;
免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3