While testing my responsive design, I've noticed that using the toggle device tool in the Inspect tools of my browser produces the expected results. However, when I simply resize the browser window manually, the design does not respond as it should. Could this be a bug?
My implementation involves JavaScript to detect the screen size with the following function:
if(window.screen.availWidth > 1024 && window.screen.availWidth < 1200) {
...
} else if(window.screen.availWidth > 1200) {
...
}
I've observed that the first condition
window.screen.availWidth > 1024 && window.screen.availWidth < 1200
is not satisfied when resizing the browser window, but works correctly when using the mobile tool in the inspect tools.
The specific mobile tool I am referring to can be seen here: https://i.sstatic.net/5FHOe.png
Could this discrepancy be a bug, or perhaps an issue related to the availWidth
property?