File: scroll.html

package info (click to toggle)
node-jquery-mousewheel 1:3.1.13-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 412 kB
  • sloc: makefile: 2; sh: 2
file content (48 lines) | stat: -rw-r--r-- 2,004 bytes parent folder | download
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
<!doctype html>
<html>
  <head>
    <title>Scroll Test</title>
    <style>
      html, body { margin: 0; padding: 0; width: 100%; height: 100%; }
      #emulated, #native {
        width: 40%;
        height: 100%;
      }
      #emulated { float: left; overflow: hidden; }
      #native { float: right; overflow: auto; }
    </style>
    <script>
      (function() {
        var verMatch = /v=([\w\.]+)/.exec(location.search),
            version = verMatch && verMatch[1],
            src;
        if (version)
          src = 'code.jquery.com/jquery-' + version;
        else
          src = 'code.jquery.com/jquery-git';
        document.write('<script src="http://' + src + '.js"><\/script>');
      })();
    </script>
    <script src="../jquery.mousewheel.js"></script>
    <script>
      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.';
      $(function() {
        for (var i=0; i<30; i++) {
          var html = '<p>' + i + ' ' + lorem + '</p>';
          $('#emulated').append(html);
          $('#native').append(html);
        }
        $('#emulated').bind('mousewheel', function(event) {
          event.preventDefault();
          var scrollTop = this.scrollTop;
          this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -1));
          //console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta);
        });
      });
    </script>
  </head>
  <body>
    <div id="emulated"></div>
    <div id="native"></div>
  </body>
</html>