jquery $(window).width() and $(window).height() return different values when viewport has not been resized

I think what you’re seeing is the hiding and showing of scrollbars. Here’s a quick demo showing the width change.

As an aside: do you need to poll constantly? You might be able to optimize your code to run on the resize event, like this:

$(window).resize(function() {
  //update stuff
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)