SHOW:
|
|
- or go back to the newest paste.
| 1 | //main class | |
| 2 | - | //other math stuff |
| 2 | + | function Section(){
|
| 3 | - | function rangeFinder(x, min, max, margin) {
|
| 3 | + | |
| 4 | - | return (x > (min - margin) && x <= (max - margin)); |
| 4 | + | |
| 5 | //constructor | |
| 6 | Section.prototype.construct = function(topOffset,offsets) {
| |
| 7 | ||
| 8 | for (var i = 0; i < offsets.length; i++) {
| |
| 9 | - | //****************************************************************************************************** |
| 9 | + | if (topOffset >= offsets[i] && topOffset < offsets[i + 1]) {
|
| 10 | - | //finds section by range in heights |
| 10 | + | this.current = offset[i]; |
| 11 | - | function setSection() {
|
| 11 | + | |
| 12 | - | var freshRun = true; |
| 12 | + | |
| 13 | - | var sections = [ |
| 13 | + | |
| 14 | - | 'section#content>section#heim', |
| 14 | + | |
| 15 | - | 'section#content>section#tilbud', |
| 15 | + | return this.current; |
| 16 | - | 'section#content>section#galleri', |
| 16 | + | |
| 17 | - | 'section#content>section#feedback' |
| 17 | + | |
| 18 | - | ]; |
| 18 | + | var Section = new Section(); |
| 19 | - | var sectionsID = [ |
| 19 | + | Section.construct(topOffset,offsets); |