C ++ BFS Seeking the shortest path

2023-01-12   ES  

IE defines its onResize incident under the Window object. When the taste is reduced, its OnResize method will be executed many times, and the number of specific execution has different values in different computers. There is no such phenomenon. For details, please refer to this article《window.onresize hangs IE6 and IE7》

High -level function Debonce is born for this

  * Window.onResize under IE can use Debonce packaging monitoring functions 
  * See http://blog.csdn.net/fudesign2008/article/details/7035537 
  * @Author[email protected]* @date 2011-11-30 
  * @time 04:02:55 afternoon 

  * @param {function} callback callback function 
  * @param {Integer} Delay delay time, the unit is milliseconds (MS), default 150 
  * @param {Object} Context context, that is, the object of this keyword point of this, defaults to NULL 
  * @Return {function} 
 function defborance (callback, delay, context) {{ 
     If (Typeof (Callback)! == "Function") {{ 
     delay = delay || 150; 
     context = context || null; 
     var timeout; 
     var ranit = function () { 
 Callback.apply (context); 
    Return (function () { 
         Window.Cleartimeout (timeout); 
         timeout = window.settimeout (runit, delay); 
 var Winresizehandler = Function (Event) { 
 console.log ("Window Resized"); 

 Window.snresize = Debonce (Winresizehandler, 300);

Very good solution


Related Posts

Method of Radio, Checkbox, Select default style

java implementation of unicode and Chinese mutual conversion

mysql data type

Android VR Player (panoramic video player) [8]: MediaPlayer+SurfaceView video playback

C ++ BFS Seeking the shortest path

Random Posts

[python] Pandas implements two tables to check highlights, go to kinglake

Electric Vehicle AMT shifting law Study -Calculation of shifting points

Bugku CTF Web (Question 10-15)

Install VS2010 Chinese flagship version of Deepwater

POJ 1797 Heavy Transportation