84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I want my visitors to be able to see high quality images, is there any way to detect the window size?
Or better yet, the viewport size of the browser using JavaScript? See the green area here:
jQuery Dimension Function
$(window).width()and$(window).height()
$(window).width()
$(window).height()
@media(width)
@media(height)
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
window.innerWidth
window.innerHeight
@media(width) and@media (height)which includes scrollbars
@media (height)
initial-scale
@media
Undefined in IE8
document.documentElement .clientWidth
.clientHeight
@media (width)
jQuery(window).width()
matchMedia
jQuery Dimension Function
$(window).width()and$(window).height()Cross-browser
@media(width)and@media(height)a> valuewindow.innerWidtha> andwindow.innerHeight一个>@media(width) and@media (height)which includes scrollbarsinitial-scaleand scalingchangesmay cause movementerrorsto scale down to a value where the PPK callsthe visual viewportand is smaller than@mediavalueUndefined in IE8-document.documentElement .clientWidthand.clientHeight@media (width)and@media (height)jQuery(window).width()jQueryCallBrowser viewportresource
matchMediato get exact dimensions in any unit