SHOW:
|
|
- or go back to the newest paste.
1 | //main class | |
2 | function Section(){ | |
3 | this.current; | |
4 | } | |
5 | ||
6 | //constructor | |
7 | Section.prototype.construct = function(topOffset,offsets) { | |
8 | ||
9 | for (var i = 0; i < offsets.length; i++) { | |
10 | if (topOffset >= offsets[i] && topOffset < offsets[i + 1]) { | |
11 | this.current = offset[i]; | |
12 | } | |
13 | } | |
14 | } | |
15 | - | return this.current; |
15 | + | |
16 | //get current | |
17 | Section.prototype.getCurrent = function() { | |
18 | return this.current; | |
19 | } | |
20 | ||
21 | var Section = new Section(); | |
22 | Section.construct(topOffset,offsets); |