mobile chrome fires resize event on scroll mobile chrome fires resize event on scroll google-chrome google-chrome

mobile chrome fires resize event on scroll


That sounds strange, but I have seen it in other browsers. You can work around this like so.

var width = $(window).width(), height = $(window).height();

then in your resize event handler you can do.

if($(window).width() != width || $(window).height() != height){  //Do something}

I don't know the scope of your functions and all that, but you should get the gist from this.


Just for curiosity, I was trying to reproduce it and if I'm correct this is caused by the navigation chrome bar.

When you scroll down and chrome hides the browser navigation bar it produces a window resize, but this is correct, because after that we have a bigger window size due to the free space that the browser nav bar has left.

Related article: https://developers.google.com/web/updates/2016/12/url-bar-resizing

Consider CWitty answer to avoid this behavior.


I don't know is it still interesting, but My solution is : )

var document_width, document_height;$(document).ready(function(){	document_width=$(document).width(); document_height=$(document).height();    // Do something}$(window).resize(function(){    if(document_width!=$(document).width() || document_height!=$(document).height())     {        document_width=$(document).width(); document_height=$(document).height();        // Do something    }}