File: index.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 (239 lines) | stat: -rw-r--r-- 7,905 bytes parent folder | download | duplicates (4)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="iso-8859-1">
        <title>Testing mousewheel plugin</title>

        <style>
            html {
                font: 13px Arial, sans-serif;
            }

            #stage {
                color: #fff;
                position: relative;
                zoom: 1;
            }

            #test1, #test2, #test3, #test4, #test5, #test6, #test7 {
                float: left;
            }

            #test1 {
                background-color: #000;
                width: 120px;
                height: 100px;
            }

            #test2 {
                background-color: #333;
                width: 120px;
                height: 100px;
            }

            #test3 {
                background-color: #666;
                width: 120px;
                height: 100px;
            }

            #test4 {
                background-color: #000;
                width: 120px;
                height: 100px;
            }

            #test5 {
                background-color: #333;
                padding: 5px;
                width: 400px;
                height: 400px;
            }

            #test6 {
                background-color: #666;
                padding: 5px;
                width: 250px;
                height: 250px;
            }

            #test7 {
                background-color: #000;
                padding: 5px;
                width: 100px;
                height: 100px;
            }

            #forceScroll {
                clear: both;
                height: 1000px;
            }

            #logger {
                position: absolute;
                top: 100px;
                left: 0;
                width: 480px;
                height: 310px;
                overflow: auto;
                z-index: 100;
            }

            #logger p {
                color: #000;
                padding: 2px;
                border-bottom: 1px solid #ccc;
                margin: 0;
            }

            #logger p:nth-child(even) {
                background-color: #ffffe8;
            }

            #logger p:nth-child(10n) {
                border-bottom-color: #000;
            }
        </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>
            $(function() {
                $('#userAgent').html(navigator.userAgent);
                $('#jqueryVersion').html($.fn.jquery);

                var loghandle = function(event, delta) {
                    var o = '', id = event.currentTarget.id || event.currentTarget.nodeName;

                    o = '#' + id + ':';

                    if (delta > 0)
                        o += ' up (' + delta + ')';
                    else if (delta < 0)
                        o += ' down (' + delta + ')';

                    if (event.deltaY > 0)
                        o += ' north (' + event.deltaY + ')';
                    else if (event.deltaY < 0)
                        o += ' south (' + event.deltaY + ')';

                    if (event.deltaX > 0)
                        o += ' east (' + event.deltaX + ')';
                    else if (event.deltaX < 0)
                        o += ' west (' + event.deltaX + ')';

                    o += ' deltaFactor (' + event.deltaFactor + ')';

                    log( o );
                };

                $(document)
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                    });

                $('#test1')
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        log('pageX: ' + event.pageX + ' pageY: ' + event.pageY );
                    });

                $('#test2')
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        return false; // prevent default
                    });

                $('#test3')
                    .hover(function() { log('#test3: mouseover'); }, function() { log('#test3: mouseout'); })
                    .mousewheel(function() {
                        log('#test3: I should not have been logged');
                    })
                    .unmousewheel();

                var testRemoval = function() {
                    log('#test4: I should not have been logged');
                };

                $('#test4')
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        return false;
                    })
                    .mousewheel(testRemoval)
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        return false;
                    })
                    .unmousewheel(testRemoval);

                $('#test5')
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        event.stopPropagation();
                        event.preventDefault();
                    });

                $('#test6')
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        event.stopPropagation();
                        event.preventDefault();
                    });

                $('#test7')
                    .mousewheel(function(event, delta) {
                        loghandle(event, delta);
                        event.preventDefault();
                    });

                function log(msg) {
                    $('#logger').append('<p>' + msg + '<\/p>')[0].scrollTop = 999999;
                }
            });
        </script>
        <script src="../jquery.mousewheel.js"></script>
    </head>
    <body>
        <h1 id="banner">jQuery mousewheel.js Test with jQuery <span id="jqueryVersion"></span></h1>
        <h2 id="userAgent"></h2>

        <ul>
            <li><strong>Test1</strong> is just using the plain on <code>mousewheel()</code> with a function passed in and does not prevent default. (Also logs the value of <code>pageX</code> and <code>pageY</code> event properties.)</li>
            <li><strong>Test2</strong> should prevent the default action.</li>
            <li><strong>Test3</strong> should only log a <code>mouseover</code> and <code>mouseout</code> event. Testing <code>unmousewheel()</code>.</li>
            <li><strong>Test4</strong> has two handlers.</li>
            <li><strong>Test5</strong> is like Test2 but has children. The children should not scroll until mousing over them.</li>
            <li><strong>Test6</strong> is like Test5 but should not scroll children or parents.</li>
            <li><strong>Test7</strong> is like Test6 but has no children. It will propagate the event and scroll test 6 as well.</li>
        </ul>


        <div id="stage">
            <div id="test1"><p>Test1</p></div>
            <div id="test2"><p>Test2</p></div>
            <div id="test3"><p>Test3</p></div>
            <div id="test4"><p>Test4</p></div>
            <div id="test5">
                <p>Test5</p>
                <div id="test6">
                    <p>Test6</p>
                    <div id="test7"><p>Test7</p></div>
                </div>
            </div>
            <div id="logger"></div>
        </div>

        <div id="forceScroll"></div>
    </body>
</html>