Why does the jQuery resize event fire twice?

后端 未结 5 772
無奈伤痛
無奈伤痛 2020-12-06 04:21

I just noticed that the jquery resize event fires twice any time the browser window is resized. I\'m unable to find any documentation listing this as the default behavior. I

5条回答
  •  独厮守ぢ
    2020-12-06 04:50

    This problem seems not to be tied neither jquery nor browser implementation. In fact if you run the second function which is javascript pure function the glitch occur too. A possible solution is, get out into a separate window the DevTools docker doing so most of the times you will not get double fire the resize event. I though that was because when the window resize, the Devtool docker resize too and triggered the resize event but it is not conclusive apparently. You can try this code without console.log.

        
            
                
                    
    
                    
                
    
                
    
                
    
                
                
                
    
    

提交回复
热议问题