Can anyone make this code?

var windowRes = document.documentElement.clientWidth;

 if (windowRes <= 1024) {
console.log('hello')
 if(windowRes <= 768) {
console.log('yes');
}
 }

I have an idea, but why 'yes' is not displayed on 768. Any idea why?
July 8th 19 at 16:29
1 answer
July 8th 19 at 16:31
Works for me, probably you have not obtained width is less than 768, it is why do?
so Yes, the crutches went. Strange, I have not worked - krista.Eichma commented on July 8th 19 at 16:34
window.use innerWidth. - mazie.Towne commented on July 8th 19 at 16:37
: What's the difference between them? - krista.Eichma commented on July 8th 19 at 16:40
The difference is that window.innerWidth includes scrollbar, if present. So Vice versa should not be used. - Cruz commented on July 8th 19 at 16:43
: Opinions differed) - krista.Eichma commented on July 8th 19 at 16:46
: And your code will work with the window.innerWidth? - mazie.Towne commented on July 8th 19 at 16:49

Find more questions by tags jQueryJavaScript