Skip to content

Commit 89baea9

Browse files
committed
add scrolling test
1 parent c7a2d66 commit 89baea9

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

test/scroll.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Scroll Test</title>
5+
<style>
6+
html, body { margin: 0; padding: 0; width: 100%; height: 100%; }
7+
#emulated, #native {
8+
width: 40%;
9+
height: 100%;
10+
}
11+
#emulated { float: left; overflow: hidden; }
12+
#native { float: right; overflow: auto; }
13+
</style>
14+
<script>
15+
(function() {
16+
var verMatch = /v=([\w\.]+)/.exec(location.search),
17+
version = verMatch && verMatch[1],
18+
src;
19+
if (version)
20+
src = 'code.jquery.com/jquery-' + version;
21+
else
22+
src = 'code.jquery.com/jquery-git';
23+
document.write('<script src="http://' + src + '.js"><\/script>');
24+
})();
25+
</script>
26+
<script src="../jquery.mousewheel.js"></script>
27+
<script>
28+
var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus nibh ac ultricies blandit. Nunc blandit blandit lobortis. Maecenas id dolor scelerisque, facilisis dolor eu, interdum urna. Nullam consectetur lectus quis mi interdum accumsan. Nulla malesuada est nec neque suscipit pulvinar. Vivamus sagittis, nunc a porttitor tempus, mi neque eleifend diam, nec porttitor metus dui a orci. Cras tempus lobortis nisl ut sagittis. Maecenas semper in magna mollis venenatis. Vestibulum fermentum tincidunt fringilla.';
29+
$(function() {
30+
for (var i=0; i<30; i++) {
31+
var html = '<p>' + i + ' ' + lorem + '</p>';
32+
$('#emulated').append(html);
33+
$('#native').append(html);
34+
}
35+
$('#emulated').bind('mousewheel', function(event) {
36+
event.preventDefault();
37+
var scrollTop = this.scrollTop;
38+
this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -1));
39+
//console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta);
40+
});
41+
});
42+
</script>
43+
</head>
44+
<body>
45+
<div id="emulated"></div>
46+
<div id="native"></div>
47+
</body>
48+
</html>

0 commit comments

Comments
 (0)