/*! * jQuery Smooth Scroll - v1.7.2 - 2016-01-23 * https://github.com/kswedberg/jquery-smooth-scroll * Copyright (c) 2016 Karl Swedberg * Licensed MIT */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){var b="1.7.2",c={},d={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},e=function(b){var c=[],d=!1,e=b.dir&&"left"===b.dir?"scrollLeft":"scrollTop";return this.each(function(){var b=a(this);if(this!==document&&this!==window)return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))):(c.push(document.scrollingElement),!1)}),c.length||this.each(function(){this===document.documentElement&&"smooth"===a(this).css("scrollBehavior")&&(c=[this]),c.length||"BODY"!==this.nodeName||(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c};a.fn.extend({scrollable:function(a){var b=e.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=e.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(b,c){if(b=b||{},"options"===b)return c?this.each(function(){var b=a(this),d=a.extend(b.data("ssOpts")||{},c);a(this).data("ssOpts",d)}):this.first().data("ssOpts");var d=a.extend({},a.fn.smoothScroll.defaults,b),e=function(b){var c=function(a){return a.replace(/(:|\.|\/)/g,"\\$1")},e=this,f=a(this),g=a.extend({},d,f.data("ssOpts")||{}),h=d.exclude,i=g.excludeWithin,j=0,k=0,l=!0,m={},n=a.smoothScroll.filterPath(location.pathname),o=a.smoothScroll.filterPath(e.pathname),p=location.hostname===e.hostname||!e.hostname,q=g.scrollTarget||o===n,r=c(e.hash);if(r&&!a(r).length&&(l=!1),g.scrollTarget||p&&q&&r){for(;l&&j * Url: http://markgoodyear.com/labs/headhesive * License: MIT */ (function(root, factory) { if (typeof define === "function" && define.amd) { define([], function() { return factory(); }); } else if (typeof exports === "object") { module.exports = factory(); } else { root.Headhesive = factory(); } })(this, function() { "use strict"; var _mergeObj = function(to, from) { for (var p in from) { if (from.hasOwnProperty(p)) { to[p] = typeof from[p] === "object" ? _mergeObj(to[p], from[p]) : from[p]; } } return to; }; var _throttle = function(func, wait) { var _now = Date.now || function() { return new Date().getTime(); }; var context, args, result; var timeout = null; var previous = 0; var later = function() { previous = _now(); timeout = null; result = func.apply(context, args); context = args = null; }; return function() { var now = _now(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); context = args = null; } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var _getScrollY = function() { return window.pageYOffset !== undefined ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; }; var _getElemY = function(elem, side) { var pos = 0; var elemHeight = elem.offsetHeight; while (elem) { pos += elem.offsetTop; elem = elem.offsetParent; } if (side === "bottom") { pos = pos + elemHeight; } return pos; }; var Headhesive = function(elem, options) { if (!("querySelector" in document && "addEventListener" in window)) { return; } this.visible = false; this.options = { offset: 300, offsetSide: "top", classes: { clone: "headhesive", stick: "headhesive--stick", unstick: "headhesive--unstick" }, throttle: 250, onInit: function() {}, onStick: function() {}, onUnstick: function() {}, onDestroy: function() {} }; this.elem = typeof elem === "string" ? document.querySelector(elem) : elem; this.options = _mergeObj(this.options, options); this.init(); }; Headhesive.prototype = { constructor: Headhesive, init: function() { this.clonedElem = this.elem.cloneNode(true); this.clonedElem.className += " " + this.options.classes.clone; document.body.insertBefore(this.clonedElem, document.body.firstChild); if (typeof this.options.offset === "number") { this.scrollOffset = this.options.offset; } else if (typeof this.options.offset === "string") { this._setScrollOffset(); } else { throw new Error("Invalid offset: " + this.options.offset); } this._throttleUpdate = _throttle(this.update.bind(this), this.options.throttle); this._throttleScrollOffset = _throttle(this._setScrollOffset.bind(this), this.options.throttle); window.addEventListener("scroll", this._throttleUpdate, false); window.addEventListener("resize", this._throttleScrollOffset, false); this.options.onInit.call(this); }, _setScrollOffset: function() { if (typeof this.options.offset === "string") { this.scrollOffset = _getElemY(document.querySelector(this.options.offset), this.options.offsetSide); } }, destroy: function() { document.body.removeChild(this.clonedElem); window.removeEventListener("scroll", this._throttleUpdate); window.removeEventListener("resize", this._throttleScrollOffset); this.options.onDestroy.call(this); }, stick: function() { if (!this.visible) { this.clonedElem.className = this.clonedElem.className.replace(new RegExp("(^|\\s)*" + this.options.classes.unstick + "(\\s|$)*", "g"), ""); this.clonedElem.className += " " + this.options.classes.stick; this.visible = true; this.options.onStick.call(this); } }, unstick: function() { if (this.visible) { this.clonedElem.className = this.clonedElem.className.replace(new RegExp("(^|\\s)*" + this.options.classes.stick + "(\\s|$)*", "g"), ""); this.clonedElem.className += " " + this.options.classes.unstick; this.visible = false; this.options.onUnstick.call(this); } }, update: function() { if (_getScrollY() > this.scrollOffset) { this.stick(); } else { this.unstick(); } } }; return Headhesive; }); /** * Merge objects * @param {Object} to * @param {Object} from * @return {Object} */ var _mergeObj = function (to, from) { for (var p in from) { if (from.hasOwnProperty(p)) { to[p] = (typeof from[p] === 'object') ? _mergeObj(to[p], from[p]) : from[p]; } } return to; }; /** * Throttle, borrowed from Underscore.js */ var _throttle = function (func, wait) { var _now = Date.now || function () { return new Date().getTime(); }; var context, args, result; var timeout = null; var previous = 0; var later = function () { previous = _now(); timeout = null; result = func.apply(context, args); context = args = null; }; return function () { var now = _now(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); context = args = null; } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; /** * Get current Y posistion * @return {Number} */ var _getScrollY = function () { return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; }; /** * Get elements Y position * @param {Object | Number} elem - The element * @param {String} side - Elem side (top or bottom) * @return {Number} */ var _getElemY = function (elem, side) { var pos = 0; var elemHeight = elem.offsetHeight; while (elem) { pos += elem.offsetTop; elem = elem.offsetParent; } if (side === 'bottom') { pos = pos + elemHeight; } return pos; }; //@ sourceMappingURL=jquery.min.map /* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g * * @param f onMouseOver function || An object with configuration options * @param g onMouseOut function || Nothing (use configuration options object) * @return The object (aka "this") that called hoverIntent, and the event object * @author Brian Cherne */ (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))