-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
44 lines (41 loc) · 909 Bytes
/
index.html
File metadata and controls
44 lines (41 loc) · 909 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery Window Scroll Detector</title>
<style>
body {
height: 15000px;
}
p {
font-family: Helvetica, Arial, sans-serif;
background: #000;
color: #FFF;
opacity: 0.7;
position: fixed;
z-index: 111;
padding: 10px;
left: 1%;
}
#scroll-number {
top: 5%;
}
#width-number {
top: 10%;
}
</style>
</head>
<body>
<p id="scroll-number">You've scrolled 0 pixels</p>
<p id="width-number">Your window width is 0 pixels</p>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
$(window).on('scroll resize',function() {
// Display window scroll
$('#scroll-number').text('You\'ve scrolled ' + $(window).scrollTop() + ' pixels');
// Display window width
$('#width-number').text('Your window width is ' + $(window).width() + ' pixels');
});
</script>
</body>
</html>