]> _ Git - fluidbook-v3.git/commitdiff
done #598 @2.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 30 Aug 2016 13:37:35 +0000 (13:37 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 30 Aug 2016 13:37:35 +0000 (13:37 +0000)
js/209-scrollify.js
js/210-home.js

index 15b3928cda08c5cc1e1b72474d107736b99cff27..a341ff4665a07246164b6505fff8c26ab64bf0cd 100644 (file)
  then value to scroll to is current position plus height of interstitialSection
 
  */
-(function (global,factory) {
+(function (global, factory) {
     "use strict";
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
-        define(['jquery'], function($) {
+        define(['jquery'], function ($) {
             return factory($, global, global.document);
         });
     } else if (typeof module === 'object' && module.exports) {
         // Node/CommonJS
-        module.exports = function( root, jQuery ) {
-            if ( jQuery === undefined ) {
+        module.exports = function (root, jQuery) {
+            if (jQuery === undefined) {
                 // require('jQuery') returns a factory that requires window to
                 // build a jQuery instance, we normalize how we use modules
                 // that require this pattern but the window provided is a noop
                 // if it's defined (how jquery works)
-                if ( typeof window !== 'undefined' ) {
+                if (typeof window !== 'undefined') {
                     jQuery = require('jquery');
                 }
                 else {
             interstitialSection: "",
             easing: "easeOutExpo",
             scrollSpeed: 1100,
-            offset : 0,
+            offset: 0,
             scrollbars: true,
-            axis:"y",
-            target:"html,body",
+            axis: "y",
+            target: "html,body",
             standardScrollElements: false,
             setHeights: true,
-            overflowScroll:true,
-            before:function() {},
-            after:function() {},
-            afterResize:function() {},
-            afterRender:function() {}
+            overflowScroll: true,
+            before: function () {
+            },
+            after: function () {
+            },
+            afterResize: function () {
+            },
+            afterRender: function () {
+            }
         };
-    function animateScroll(index,instant,callbacks) {
-        if(currentIndex===index) {
+
+    function animateScroll(index, instant, callbacks) {
+        if (currentIndex === index) {
             callbacks = false;
         }
-        if(disabled===true) {
+        if (disabled === true) {
             return true;
         }
-        if(names[index]) {
+        if (names[index]) {
             scrollable = false;
-            if(callbacks) {
-                settings.before(index,elements);
+            if (callbacks) {
+                settings.before(index, elements);
             }
             interstitialIndex = 1;
 
             // }
 
 
-            if(instant) {
+            if (instant) {
                 $(settings.target).stop().scrollTop(heights[index]);
-                if(callbacks) {
-                    settings.after(index,elements);
+                if (callbacks) {
+                    settings.after(index, elements);
                 }
             } else {
                 locked = true;
-                if( $().velocity ) {
+                if ($().velocity) {
                     $(settings.target).stop().velocity('scroll', {
                         duration: settings.scrollSpeed,
                         easing: settings.easing,
 
                     //console.info(index + ' -- Scrolling to: ' + heights[index] + ' | ' + settings.scrollSpeed + ' | ' + settings.easing);
 
+
                     $(settings.target).stop().animate({
-                        scrollTop: heights[index]
-                    }, settings.scrollSpeed,settings.easing);
+                        scrollTop: heights[index], skipGSAP: true
+                    }, settings.scrollSpeed, settings.easing, function () {
+                        $(window).scrollTop(heights[index]);
+                    });
                 }
 
-                if(window.location.hash.length && settings.sectionName && window.console) {
+                if (window.location.hash.length && settings.sectionName && window.console) {
                     try {
-                        if($(window.location.hash).length) {
+                        if ($(window.location.hash).length) {
                             console.warn("Scrollify warning: There are IDs on the page that match the hash value - this will cause the page to anchor.");
                         }
                     } catch (e) {
                         console.warn("Scrollify warning:", window.location.hash, "is not a valid jQuery expression.");
                     }
                 }
-                $(settings.target).promise().done(function(){
+                $(settings.target).promise().done(function () {
                     currentIndex = index;
                     locked = false;
                     firstLoad = false;
-                    if(callbacks) {
-                        settings.after(index,elements);
+                    if (callbacks) {
+                        settings.after(index, elements);
                     }
                 });
             }
 
             var lastElements = samples.slice(Math.max(samples.length - num, 1));
 
-            for(var i = 0; i < lastElements.length; i++){
+            for (var i = 0; i < lastElements.length; i++) {
                 sum += lastElements[i];
             }
 
-            return Math.ceil(sum/num);
+            return Math.ceil(sum / num);
         }
 
         var avEnd = average(10);
         var avMiddle = average(70);
 
-        if(avEnd >= avMiddle) {
+        if (avEnd >= avMiddle) {
             return true;
         } else {
             return false;
         }
     }
-    $.scrollify = function(options) {
+
+    $.scrollify = function (options) {
         initialised = true;
 
-        $.easing['easeOutExpo'] = function(x, t, b, c, d) {
-            return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+        $.easing['easeOutExpo'] = function (x, t, b, c, d) {
+            return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
         };
 
         manualScroll = {
-            handleMousedown:function() {
-                if(disabled===true) {
+            handleMousedown: function () {
+                if (disabled === true) {
                     return true;
                 }
                 scrollable = false;
                 scrolled = false;
             },
-            handleMouseup:function() {
-                if(disabled===true) {
+            handleMouseup: function () {
+                if (disabled === true) {
                     return true;
                 }
                 scrollable = true;
-                if(scrolled) {
+                if (scrolled) {
                     manualScroll.calculateNearest();
                 }
             },
-            handleScroll:function() {
-                if(disabled===true) {
+            handleScroll: function () {
+                if (disabled === true) {
                     return true;
                 }
-                if(timeoutId){
+                if (timeoutId) {
                     clearTimeout(timeoutId);
                 }
-                timeoutId = setTimeout(function(){
+                timeoutId = setTimeout(function () {
 
                     scrolled = true;
-                    if(scrollable===false) {
+                    if (scrollable === false) {
                         return false;
                     }
                     scrollable = false;
 
                 }, 200);
             },
-            calculateNearest:function() {
+            calculateNearest: function () {
                 top = $window.scrollTop();
-                var i =1,
+                var i = 1,
                     max = heights.length,
                     closest = 0,
                     prev = Math.abs(heights[0] - top),
                     diff;
-                for(;i<max;i++) {
+                for (; i < max; i++) {
                     diff = Math.abs(heights[i] - top);
 
-                    if(diff < prev) {
+                    if (diff < prev) {
                         prev = diff;
                         closest = i;
                     }
                 }
-                if(atBottom() || atTop()) {
+                if (atBottom() || atTop()) {
                     index = closest;
-                    animateScroll(closest,false,true);
+                    animateScroll(closest, false, true);
                 }
             },
-            wheelHandler:function(e,delta) {
-                if(disabled===true) {
+            wheelHandler: function (e, delta) {
+                if (disabled === true) {
                     return true;
-                } else if(settings.standardScrollElements) {
-                    if($(e.target).is(settings.standardScrollElements) || $(e.target).closest(settings.standardScrollElements).length) {
+                } else if (settings.standardScrollElements) {
+                    if ($(e.target).is(settings.standardScrollElements) || $(e.target).closest(settings.standardScrollElements).length) {
                         return true;
                     }
                 }
-                if(!overflow[index]) {
+                if (!overflow[index]) {
                     e.preventDefault();
                 }
                 var currentScrollTime = new Date().getTime();
 
 
-
                 e = e || window.event;
                 var value = e.originalEvent.wheelDelta || -e.originalEvent.deltaY || -e.originalEvent.detail;
                 var delta = Math.max(-1, Math.min(1, value));
 
 
-
                 //delta = delta || -e.originalEvent.detail / 3 || e.originalEvent.wheelDelta / 120;
 
 
-                if(scrollSamples.length > 149){
+                if (scrollSamples.length > 149) {
                     scrollSamples.shift();
                 }
                 //scrollSamples.push(Math.abs(delta*10));
                 scrollSamples.push(Math.abs(value));
 
-                if((currentScrollTime-scrollTime) > 200){
+                if ((currentScrollTime - scrollTime) > 200) {
                     scrollSamples = [];
                 }
                 scrollTime = currentScrollTime;
 
 
-                if(locked) {
+                if (locked) {
                     return false;
                 }
 
-                if(delta<0) {
-                    if(index<heights.length-1) {
-                        if(atBottom()) {
-                            if(isAccelerating(scrollSamples)) {
+                if (delta < 0) {
+                    if (index < heights.length - 1) {
+                        if (atBottom()) {
+                            if (isAccelerating(scrollSamples)) {
                                 e.preventDefault();
                                 index++;
                                 locked = true;
-                                animateScroll(index,false,true);
+                                animateScroll(index, false, true);
                             } else {
                                 return false;
                             }
                         }
                     }
-                } else if(delta>0) {
-                    if(index>0) {
-                        if(atTop()) {
-                            if(isAccelerating(scrollSamples)) {
+                } else if (delta > 0) {
+                    if (index > 0) {
+                        if (atTop()) {
+                            if (isAccelerating(scrollSamples)) {
                                 e.preventDefault();
                                 index--;
                                 locked = true;
-                                animateScroll(index,false,true);
+                                animateScroll(index, false, true);
                             } else {
                                 return false
                             }
                 }
 
             },
-            keyHandler:function(e) {
-                if(disabled===true) {
+            keyHandler: function (e) {
+                if (disabled === true) {
                     return true;
                 }
-                if(locked===true) {
+                if (locked === true) {
                     return false;
                 }
-                if(e.keyCode==38) {
-                    if(index>0) {
-                        if(atTop()) {
+                if (e.keyCode == 38) {
+                    if (index > 0) {
+                        if (atTop()) {
                             e.preventDefault();
                             index--;
-                            animateScroll(index,false,true);
+                            animateScroll(index, false, true);
                         }
                     }
-                } else if(e.keyCode==40) {
-                    if(index<heights.length-1) {
-                        if(atBottom()) {
+                } else if (e.keyCode == 40) {
+                    if (index < heights.length - 1) {
+                        if (atBottom()) {
                             e.preventDefault();
                             index++;
-                            animateScroll(index,false,true);
+                            animateScroll(index, false, true);
                         }
                     }
                 }
             },
-            init:function() {
-                if(settings.scrollbars) {
+            init: function () {
+                if (settings.scrollbars) {
                     $window.bind('mousedown', manualScroll.handleMousedown);
                     $window.bind('mouseup', manualScroll.handleMouseup);
                     $window.bind('scroll', manualScroll.handleScroll);
                 } else {
-                    $("body").css({"overflow":"hidden"});
+                    $("body").css({"overflow": "hidden"});
                 }
 
-                $(document).bind(wheelEvent,manualScroll.wheelHandler);
+                $(document).bind(wheelEvent, manualScroll.wheelHandler);
                 $(document).bind('keydown', manualScroll.keyHandler);
             }
         };
 
         swipeScroll = {
-            touches : {
-                "touchstart": {"y":-1,"x":-1},
-                "touchmove" : {"y":-1,"x":-1},
-                "touchend"  : false,
-                "direction" : "undetermined"
+            touches: {
+                "touchstart": {"y": -1, "x": -1},
+                "touchmove": {"y": -1, "x": -1},
+                "touchend": false,
+                "direction": "undetermined"
             },
-            options:{
-                "distance" : 30,
-                "timeGap" : 800,
-                "timeStamp" : new Date().getTime()
+            options: {
+                "distance": 30,
+                "timeGap": 800,
+                "timeStamp": new Date().getTime()
             },
-            touchHandler: function(event) {
-                if(disabled===true) {
+            touchHandler: function (event) {
+                if (disabled === true) {
                     return true;
-                } else if(settings.standardScrollElements) {
-                    if($(event.target).is(settings.standardScrollElements) || $(event.target).closest(settings.standardScrollElements).length) {
+                } else if (settings.standardScrollElements) {
+                    if ($(event.target).is(settings.standardScrollElements) || $(event.target).closest(settings.standardScrollElements).length) {
                         return true;
                     }
                 }
                 var touch;
-                if (typeof event !== 'undefined'){
+                if (typeof event !== 'undefined') {
                     if (typeof event.touches !== 'undefined') {
                         touch = event.touches[0];
                         switch (event.type) {
                             case 'touchmove':
                                 swipeScroll.touches.touchmove.y = touch.pageY;
                                 swipeScroll.touches.touchmove.x = touch.pageX;
-                                if(swipeScroll.touches.touchstart.y!==swipeScroll.touches.touchmove.y && (Math.abs(swipeScroll.touches.touchstart.y-swipeScroll.touches.touchmove.y)>Math.abs(swipeScroll.touches.touchstart.x-swipeScroll.touches.touchmove.x))) {
+                                if (swipeScroll.touches.touchstart.y !== swipeScroll.touches.touchmove.y && (Math.abs(swipeScroll.touches.touchstart.y - swipeScroll.touches.touchmove.y) > Math.abs(swipeScroll.touches.touchstart.x - swipeScroll.touches.touchmove.x))) {
                                     //if(!overflow[index]) {
                                     event.preventDefault();
                                     //}
                                     swipeScroll.touches.direction = "y";
-                                    if((swipeScroll.options.timeStamp+swipeScroll.options.timeGap)<(new Date().getTime()) && swipeScroll.touches.touchend == false) {
+                                    if ((swipeScroll.options.timeStamp + swipeScroll.options.timeGap) < (new Date().getTime()) && swipeScroll.touches.touchend == false) {
 
                                         swipeScroll.touches.touchend = true;
                                         if (swipeScroll.touches.touchstart.y > -1) {
 
-                                            if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) {
-                                                if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
+                                            if (Math.abs(swipeScroll.touches.touchmove.y - swipeScroll.touches.touchstart.y) > swipeScroll.options.distance) {
+                                                if (swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
 
                                                     swipeScroll.up();
 
                                 }
                                 break;
                             case 'touchend':
-                                if(swipeScroll.touches[event.type]===false) {
+                                if (swipeScroll.touches[event.type] === false) {
                                     swipeScroll.touches[event.type] = true;
-                                    if (swipeScroll.touches.touchstart.y > -1 && swipeScroll.touches.touchmove.y > -1 && swipeScroll.touches.direction==="y") {
+                                    if (swipeScroll.touches.touchstart.y > -1 && swipeScroll.touches.touchmove.y > -1 && swipeScroll.touches.direction === "y") {
 
-                                        if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) {
-                                            if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
+                                        if (Math.abs(swipeScroll.touches.touchmove.y - swipeScroll.touches.touchstart.y) > swipeScroll.options.distance) {
+                                            if (swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
                                                 swipeScroll.up();
 
                                             } else {
                     }
                 }
             },
-            down: function() {
-                if(index<=heights.length-1) {
+            down: function () {
+                if (index <= heights.length - 1) {
 
-                    if(atBottom() && index<heights.length-1) {
+                    if (atBottom() && index < heights.length - 1) {
 
                         index++;
-                        animateScroll(index,false,true);
+                        animateScroll(index, false, true);
                     } else {
-                        if(Math.floor(elements[index].height()/$window.height())>interstitialIndex) {
+                        if (Math.floor(elements[index].height() / $window.height()) > interstitialIndex) {
 
                             // interstitialScroll(parseInt(heights[index])+($window.height()*interstitialIndex));
-                            interstitialScroll(Math.round(heights[index])+($window.height()*interstitialIndex));
+                            interstitialScroll(Math.round(heights[index]) + ($window.height() * interstitialIndex));
                             interstitialIndex += 1;
 
                         } else {
                             // interstitialScroll(parseInt(heights[index])+(elements[index].height()-$window.height()));
-                            interstitialScroll(Math.round(heights[index])+(elements[index].height()-$window.height()));
+                            interstitialScroll(Math.round(heights[index]) + (elements[index].height() - $window.height()));
                         }
 
                     }
                 }
             },
-            up: function() {
-                if(index>=0) {
-                    if(atTop() && index>0) {
+            up: function () {
+                if (index >= 0) {
+                    if (atTop() && index > 0) {
 
                         index--;
-                        animateScroll(index,false,true);
+                        animateScroll(index, false, true);
                     } else {
 
-                        if(interstitialIndex>2) {
+                        if (interstitialIndex > 2) {
 
                             interstitialIndex -= 1;
                             // interstitialScroll(parseInt(heights[index])+($window.height()*interstitialIndex));
-                            interstitialScroll(Math.round(heights[index])+($window.height()*interstitialIndex));
+                            interstitialScroll(Math.round(heights[index]) + ($window.height() * interstitialIndex));
 
                         } else {
 
 
                 }
             },
-            init: function() {
+            init: function () {
                 if (document.addEventListener) {
                     document.addEventListener('touchstart', swipeScroll.touchHandler, false);
                     document.addEventListener('touchmove', swipeScroll.touchHandler, false);
 
 
         util = {
-            refresh:function(withCallback) {
+            refresh: function (withCallback) {
                 clearTimeout(timeoutId2);
-                timeoutId2 = setTimeout(function() {
+                timeoutId2 = setTimeout(function () {
                     sizePanels();
                     calculatePositions(true);
-                    if(withCallback) {
+                    if (withCallback) {
                         settings.afterResize();
                     }
-                },400);
+                }, 400);
             },
-            handleUpdate:function() {
+            handleUpdate: function () {
                 util.refresh(false);
             },
-            handleResize:function() {
+            handleResize: function () {
                 util.refresh(true);
             }
         };
 
         calculatePositions(false);
 
-        if(true===hasLocation) {
-            animateScroll(index,false,true);
+        if (true === hasLocation) {
+            animateScroll(index, false, true);
         } else {
-            setTimeout(function() {
-                animateScroll(0,false,true);
-            },200);
+            setTimeout(function () {
+                animateScroll(0, false, true);
+            }, 200);
         }
-        if(heights.length) {
+        if (heights.length) {
             manualScroll.init();
             swipeScroll.init();
 
-            $window.bind("resize",util.handleResize);
+            $window.bind("resize", util.handleResize);
             if (document.addEventListener) {
                 window.addEventListener("orientationchange", util.handleResize, false);
             }
         }
         function interstitialScroll(pos) {
-            if( $().velocity ) {
+            if ($().velocity) {
                 $(settings.target).stop().velocity('scroll', {
                     duration: settings.scrollSpeed,
                     easing: settings.easing,
             } else {
                 $(settings.target).stop().animate({
                     scrollTop: pos
-                }, settings.scrollSpeed,settings.easing);
+                }, settings.scrollSpeed, settings.easing);
             }
         }
 
         function sizePanels() {
             var selector = settings.section;
             overflow = [];
-            if(settings.interstitialSection.length) {
+            if (settings.interstitialSection.length) {
                 selector += "," + settings.interstitialSection;
             }
-            $(selector).each(function(i) {
+            $(selector).each(function (i) {
 
-                if(settings.setHeights) {
-                    if($(this).is(settings.interstitialSection)) {
+                if (settings.setHeights) {
+                    if ($(this).is(settings.interstitialSection)) {
                         overflow[i] = false;
                     } else {
 
-                        if(($(this).css("height","auto").outerHeight()<$window.height()) || $(this).css("overflow")==="hidden") {
-                            $(this).css({"height":$window.height()});
+                        if (($(this).css("height", "auto").outerHeight() < $window.height()) || $(this).css("overflow") === "hidden") {
+                            $(this).css({"height": $window.height()});
 
                             overflow[i] = false;
                         } else {
 
-                            $(this).css({"height":$(this).height()});
+                            $(this).css({"height": $(this).height()});
 
-                            if(settings.overflowScroll) {
+                            if (settings.overflowScroll) {
                                 overflow[i] = true;
                             } else {
                                 overflow[i] = false;
 
                 } else {
 
-                    if(($(this).outerHeight()<$window.height()) || (settings.overflowScroll===false)) {
+                    if (($(this).outerHeight() < $window.height()) || (settings.overflowScroll === false)) {
                         overflow[i] = false;
                     } else {
                         overflow[i] = true;
                 }
             });
         }
+
         function calculatePositions(resize) {
             var selector = settings.section;
-            if(settings.interstitialSection.length) {
+            if (settings.interstitialSection.length) {
                 selector += "," + settings.interstitialSection;
             }
             heights = [];
             names = [];
             elements = [];
-            $(selector).each(function(i){
-                if(i>0) {
+            $(selector).each(function (i) {
+                if (i > 0) {
                     // heights[i] = parseInt($(this).offset().top) + settings.offset;
                     heights[i] = Math.round($(this).offset().top) + settings.offset;
                 } else {
                     // heights[i] = parseInt($(this).offset().top);
-                    heights[i] = Math.round($(this).offset().top);
+                    heights[i] = Math.round($(this).offset().top) + 1;
                 }
-                if(settings.sectionName && $(this).data(settings.sectionName)) {
-                    names[i] = "#" + $(this).data(settings.sectionName).replace(/ /g,"-");
+                if (settings.sectionName && $(this).data(settings.sectionName)) {
+                    names[i] = "#" + $(this).data(settings.sectionName).replace(/ /g, "-");
                 } else {
-                    if($(this).is(settings.interstitialSection)===false) {
+                    if ($(this).is(settings.interstitialSection) === false) {
                         names[i] = "#" + (i + 1);
                     } else {
                         names[i] = "#";
-                        if(i===$(selector).length-1 && i>1) { // If it's the last element, we will add its height so scroll goes right to the bottom
+                        if (i === $(selector).length - 1 && i > 1) { // If it's the last element, we will add its height so scroll goes right to the bottom
 
                             //---------
                             // ## PATCHED by Stephen to take into account the CSS scaled size of the element...
                             //heights[i] = heights[i-1]+parseInt($(this).height()); // Original code
-                            heights[i] = heights[i-1] + Math.round($(this)[0].getBoundingClientRect().height);
+                            heights[i] = heights[i - 1] + Math.round($(this)[0].getBoundingClientRect().height);
                             //---------
                         }
                     }
                 }
                 elements[i] = $(this);
                 try {
-                    if($(names[i]).length && window.console) {
+                    if ($(names[i]).length && window.console) {
                         console.warn("Scrollify warning: Section names can't match IDs on the page - this will cause the browser to anchor.");
                     }
-                } catch (e) {}
+                } catch (e) {
+                }
 
-                if(window.location.hash===names[i]) {
+                if (window.location.hash === names[i]) {
                     index = i;
                     hasLocation = true;
                 }
 
             });
 
-            if(true===resize) {
-                animateScroll(index,false,false);
+            if (true === resize) {
+                animateScroll(index, false, false);
             } else {
                 settings.afterRender();
             }
         }
 
         function atTop() {
-            if(!overflow[index]) {
+            if (!overflow[index]) {
                 return true;
             }
             top = $window.scrollTop();
-            if(top>parseInt(heights[index])) {
+            if (top > parseInt(heights[index])) {
                 return false;
             } else {
                 return true;
             }
         }
+
         function atBottom() {
-            if(!overflow[index]) {
+            if (!overflow[index]) {
                 return true;
             }
             top = $window.scrollTop();
 
-            if(top<parseInt(heights[index])+(elements[index].outerHeight()-$window.height())-28) {
+            if (top < parseInt(heights[index]) + (elements[index].outerHeight() - $window.height()) - 28) {
 
                 return false;
 
         }
     }
 
-    function move(panel,instant) {
+    function move(panel, instant) {
         var z = names.length;
-        for(;z>=0;z--) {
-            if(typeof panel === 'string') {
-                if (names[z]===panel) {
+        for (; z >= 0; z--) {
+            if (typeof panel === 'string') {
+                if (names[z] === panel) {
                     index = z;
-                    animateScroll(z,instant,true);
+                    animateScroll(z, instant, true);
                 }
             } else {
-                if(z===panel) {
+                if (z === panel) {
                     index = z;
-                    animateScroll(z,instant,true);
+                    animateScroll(z, instant, true);
                 }
             }
         }
     }
-    $.scrollify.move = function(panel) {
-        if(panel===undefined) {
+
+    $.scrollify.move = function (panel) {
+        if (panel === undefined) {
             return false;
         }
-        if(panel.originalEvent) {
+        if (panel.originalEvent) {
             panel = $(this).attr("href");
         }
-        move(panel,false);
+        move(panel, false);
     };
-    $.scrollify.instantMove = function(panel) {
-        if(panel===undefined) {
+    $.scrollify.instantMove = function (panel) {
+        if (panel === undefined) {
             return false;
         }
-        move(panel,true);
+        move(panel, true);
     };
-    $.scrollify.next = function() {
-        if(index<names.length) {
+    $.scrollify.next = function () {
+        if (index < names.length) {
             index += 1;
-            animateScroll(index,false,true);
+            animateScroll(index, false, true);
         }
     };
-    $.scrollify.previous = function() {
-        if(index>0) {
+    $.scrollify.previous = function () {
+        if (index > 0) {
             index -= 1;
-            animateScroll(index,false,true);
+            animateScroll(index, false, true);
         }
     };
-    $.scrollify.instantNext = function() {
-        if(index<names.length) {
+    $.scrollify.instantNext = function () {
+        if (index < names.length) {
             index += 1;
-            animateScroll(index,true,true);
+            animateScroll(index, true, true);
         }
     };
-    $.scrollify.instantPrevious = function() {
-        if(index>0) {
+    $.scrollify.instantPrevious = function () {
+        if (index > 0) {
             index -= 1;
-            animateScroll(index,true,true);
+            animateScroll(index, true, true);
         }
     };
-    $.scrollify.destroy = function() {
-        if(!initialised) {
+    $.scrollify.destroy = function () {
+        if (!initialised) {
             return false;
         }
-        if(settings.setHeights) {
-            $(settings.section).each(function() {
-                $(this).css("height","auto");
+        if (settings.setHeights) {
+            $(settings.section).each(function () {
+                $(this).css("height", "auto");
             });
         }
-        $window.unbind("resize",util.handleResize);
-        if(settings.scrollbars) {
+        $window.unbind("resize", util.handleResize);
+        if (settings.scrollbars) {
             $window.unbind('mousedown', manualScroll.handleMousedown);
             $window.unbind('mouseup', manualScroll.handleMouseup);
             $window.unbind('scroll', manualScroll.handleScroll);
         }
-        $(document).unbind(wheelEvent,manualScroll.wheelHandler);
+        $(document).unbind(wheelEvent, manualScroll.wheelHandler);
         $(document).unbind('keydown', manualScroll.keyHandler);
 
         if (document.addEventListener) {
         elements = [];
         overflow = [];
     };
-    $.scrollify.update = function() {
-        if(!initialised) {
+    $.scrollify.update = function () {
+        if (!initialised) {
             return false;
         }
         util.handleUpdate();
     };
-    $.scrollify.current = function() {
+    $.scrollify.current = function () {
         return elements[index];
     };
-    $.scrollify.disable = function() {
+    $.scrollify.disable = function () {
         disabled = true;
     };
-    $.scrollify.enable = function() {
+    $.scrollify.enable = function () {
         disabled = false;
         if (typeof manualScroll !== 'undefined') {
             manualScroll.calculateNearest();
         }
     };
-    $.scrollify.isDisabled = function() {
+    $.scrollify.isDisabled = function () {
         return disabled;
     };
-    $.scrollify.setOptions = function(updatedOptions) {
-        if(!initialised) {
+    $.scrollify.setOptions = function (updatedOptions) {
+        if (!initialised) {
             return false;
         }
-        if(typeof updatedOptions === "object") {
+        if (typeof updatedOptions === "object") {
             settings = $.extend(settings, updatedOptions);
             util.handleUpdate();
-        } else if(window.console) {
+        } else if (window.console) {
             console.warn("Scrollify warning: Options need to be in an object.");
         }
     };
index ef70aef542cb8423b561d7d6aee1ada25da1d0f2..18d9a541f97780998242da9e0e91983e52b3b291 100644 (file)
@@ -6,13 +6,13 @@ function load_home() {
 \r
     // Bouncing scroll down arrow\r
     // Show scroll-down arrow after a small delay\r
-    setTimeout(function() {\r
+    setTimeout(function () {\r
         $('.scroll-arrow').fadeIn(1000);\r
         // Animate arrow\r
         TweenMax.to($('.scroll-arrow'), 1, {bottom: "+=15px", yoyo: true, repeat: -1, ease: Linear.easeNone});\r
     }, 2500);\r
 \r
-    $(document).on('click', '.scroll-arrow', function(e) {\r
+    $(document).on('click', '.scroll-arrow', function (e) {\r
         $('html,body').animate({\r
             scrollTop: $('#contentWrapper section:nth-of-type(2)').offset().top\r
         }, 1100, 'easeOutExpo');\r
@@ -20,16 +20,16 @@ function load_home() {
     });\r
 \r
     // Handle clicks on pagination dots\r
-    $(".pagination li").on("click",function() {\r
+    $(".pagination li").on("click", function () {\r
         $.scrollify.move($(this).data('section'));\r
     });\r
 \r
     // Handle clicks to AJAX popups and disable scrollify when they open\r
     // because it interferes with internal popup scrolling\r
-    $(document).on('click', '.popup', function() {\r
+    $(document).on('click', '.popup', function () {\r
         disableScrollify();\r
     });\r
-    $(document).on('click', '.closePopup', function() {\r
+    $(document).on('click', '.closePopup', function () {\r
         resizeHome(); // Update layout and re-enable scrollify if space requirements are met\r
     });\r
 }\r
@@ -46,8 +46,8 @@ function resizeHome() {
     calculateZoom();\r
 \r
     // Resize sections, allowing for scale factor that will be applied to parent element\r
-    var wh = Math.ceil($(window).outerHeight() / zoom);\r
-    var ww = Math.ceil($(window).outerWidth() / zoom);\r
+    var wh = $(window).outerHeight() / zoom;\r
+    var ww = $(window).outerWidth() / zoom;\r
 \r
     resizeHomeContact(ww, wh);\r
     resizeHomeReferences(ww, wh);\r
@@ -57,7 +57,7 @@ function resizeHome() {
         disableScrollify();\r
     } else if (!isTallEnough()) {\r
         // Size each section according to its content and background image ratio\r
-        sections.each(function() {\r
+        sections.each(function () {\r
 \r
             var bgHolder = $(this).find('[data-bg-ratio]'),\r
                 bgHeight = 0,\r
@@ -90,7 +90,7 @@ function isTallEnough() {
     var contentHeight;\r
     var sectionHeight;\r
 \r
-    $('section .content-wrapper').each(function() {\r
+    $('section .content-wrapper').each(function () {\r
 \r
         // First, check if the section has a background image that forces a minimum ratio for the size\r
         if ($(this).data('bg-ratio')) {\r
@@ -121,7 +121,7 @@ function initScrollify() {
         scrollbars: true,\r
         interstitialSection: '.auto-height',\r
         setHeights: false,\r
-        before: function(index, sections) {\r
+        before: function (index, sections) {\r
             //fb("before: #" + index, sections.length);\r
 \r
             // Handle scrolling to last (footer) section\r
@@ -138,7 +138,7 @@ function initScrollify() {
 \r
             } else {\r
 \r
-                setTimeout(function() {\r
+                setTimeout(function () {\r
                     $('#h').css({\r
                         'background-color': 'transparent',\r
                         'box-shadow': '0 0 0 rgba(0,0,0,0)'\r
@@ -156,10 +156,10 @@ function initScrollify() {
             $(".pagination .active").css('color', '').removeClass('active');\r
             $(".pagination").find('[data-section="#' + ref + '"]').css('color', color).addClass('active');\r
         },\r
-        afterRender:function() {\r
+        afterRender: function () {\r
             var pagination = '<ul class="pagination">';\r
 \r
-            $('[data-section-name]').each(function(i) {\r
+            $('[data-section-name]').each(function (i) {\r
                 pagination += '<li data-section="#' + $(this).attr('data-section-name') + '"><span class="hover-text">' + $(this).attr('data-section-name').charAt(0).toUpperCase() + $(this).attr('data-section-name').slice(1) + '</span></li>';\r
             });\r
 \r
@@ -189,7 +189,7 @@ function disableScrollify() {
         fullPages = false;\r
         $.scrollify.disable();\r
         setHeaderAnimation(); // Update header animation settings for normal scrolling\r
-        $('html,body').animate({scrollTop: $(window).scrollTop() + 1 }, 0); // Scroll down 1px to trigger header animation update\r
+        $('html,body').animate({scrollTop: $(window).scrollTop() + 1}, 0); // Scroll down 1px to trigger header animation update\r
     }\r
 }\r
 \r