-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget viewport size in Real Time - 1_ from ViewPort (jQuery).html
More file actions
49 lines (17 loc) · 1.63 KB
/
get viewport size in Real Time - 1_ from ViewPort (jQuery).html
File metadata and controls
49 lines (17 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!doctype html>
<!-- "doctype html" seems to be necessary in order to allow jQuery to get the correct Browser ViewPort width\height size -->
<!-- "doctype html" declaration must be the very first thing in your HTML document, before the "html" tag -->
<p id="ViewPortSize"> </p>
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<!-- Load jQuery hosted by Google into your website -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
function GetViewPortSize() {
$('#ViewPortSize').text("Width = " + $( window ).width() + " / Height = " + $( window ).height()); /* <!doctype html> may be necessary */
}
/* Execute "GetViewPortSize" function at page load */
$(GetViewPortSize);
/* Execute "GetViewPortSize" function everytime the browser viewport is resized */
$( window ).resize(GetViewPortSize);
</script>