N
N
Nazar2020-07-01 14:13:54
css
Nazar, 2020-07-01 14:13:54

Incorrect $(window).width() on mobile. What could be the problem?

Hello!
There is a resource https://fotostudio-ok.eu/ on Drupal. This project was done by another dev. I saw the following situation: there is an adaptive version of the site, but it is displayed only when the browser width is reduced using the slider. If you click in developer mode on the Toggle device Toolbar in chrome and reload the page, the styles change. For some reason, the browser thinks that the block width is 980 (you can see this in the console) and does not load media queries. And at the first option - the width is correct.

Perhaps someone faced such a problem? I will be grateful!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Lyskov, 2020-07-01
@n_zuza

add meta tag to head

<meta name="viewport" content="width=device-width, initial-scale=1">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question