|
@@ -1,6 +1,578 @@
|
|
|
-(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
|
-(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
|
-m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
|
-})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
-ga('create', 'UA-1906067-6', 'davidawindham.com');
|
|
|
-ga('send', 'pageview');
|
|
|
+// The MIT License (MIT)
|
|
|
+// Typed.js | Copyright (c) 2014 Matt Boldt | www.mattboldt.com
|
|
|
+
|
|
|
+
|
|
|
+!function($){
|
|
|
+
|
|
|
+ "use strict";
|
|
|
+
|
|
|
+ var Typed = function(el, options){
|
|
|
+
|
|
|
+ // chosen element to manipulate text
|
|
|
+ this.el = $(el);
|
|
|
+
|
|
|
+ // options
|
|
|
+ this.options = $.extend({}, $.fn.typed.defaults, options);
|
|
|
+
|
|
|
+ // text content of element
|
|
|
+ this.baseText = this.el.text() || this.el.attr('placeholder') || '';
|
|
|
+
|
|
|
+ // typing speed
|
|
|
+ this.typeSpeed = this.options.typeSpeed;
|
|
|
+
|
|
|
+ // add a delay before typing starts
|
|
|
+ this.startDelay = this.options.startDelay;
|
|
|
+
|
|
|
+ // backspacing speed
|
|
|
+ this.backSpeed = this.options.backSpeed;
|
|
|
+
|
|
|
+ // amount of time to wait before backspacing
|
|
|
+ this.backDelay = this.options.backDelay;
|
|
|
+
|
|
|
+ // input strings of text
|
|
|
+ this.strings = this.options.strings;
|
|
|
+
|
|
|
+ // character number position of current string
|
|
|
+ this.strPos = 0;
|
|
|
+
|
|
|
+ // current array position
|
|
|
+ this.arrayPos = 0;
|
|
|
+
|
|
|
+ // number to stop backspacing on.
|
|
|
+ // default 0, can change depending on how many chars
|
|
|
+ // you want to remove at the time
|
|
|
+ this.stopNum = 0;
|
|
|
+
|
|
|
+ // Looping logic
|
|
|
+ this.loop = this.options.loop;
|
|
|
+ this.loopCount = this.options.loopCount;
|
|
|
+ this.curLoop = 0;
|
|
|
+
|
|
|
+ // for stopping
|
|
|
+ this.stop = false;
|
|
|
+
|
|
|
+ // show cursor
|
|
|
+ this.showCursor = this.isInput ? false : this.options.showCursor;
|
|
|
+
|
|
|
+ // custom cursor
|
|
|
+ this.cursorChar = this.options.cursorChar;
|
|
|
+
|
|
|
+ // attribute to type
|
|
|
+ this.isInput = this.el.is('input');
|
|
|
+ this.attr = this.options.attr || (this.isInput ? 'placeholder' : null);
|
|
|
+
|
|
|
+ // All systems go!
|
|
|
+ this.build();
|
|
|
+ };
|
|
|
+
|
|
|
+ Typed.prototype = {
|
|
|
+
|
|
|
+ constructor: Typed
|
|
|
+
|
|
|
+ , init: function(){
|
|
|
+ // begin the loop w/ first current string (global self.string)
|
|
|
+ // current string will be passed as an argument each time after this
|
|
|
+ var self = this;
|
|
|
+ self.timeout = setTimeout(function() {
|
|
|
+ // Start typing
|
|
|
+ self.typewrite(self.strings[self.arrayPos], self.strPos);
|
|
|
+ }, self.startDelay);
|
|
|
+ }
|
|
|
+
|
|
|
+ , build: function(){
|
|
|
+ // Insert cursor
|
|
|
+ if (this.showCursor === true){
|
|
|
+ this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>");
|
|
|
+ this.el.after(this.cursor);
|
|
|
+ }
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+
|
|
|
+ // pass current string state to each function, types 1 char per call
|
|
|
+ , typewrite: function(curString, curStrPos){
|
|
|
+ // exit when stopped
|
|
|
+ if(this.stop === true)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // varying values for setTimeout during typing
|
|
|
+ // can't be global since number changes each time loop is executed
|
|
|
+ var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed;
|
|
|
+ var self = this;
|
|
|
+
|
|
|
+ // ------------- optional ------------- //
|
|
|
+ // backpaces a certain string faster
|
|
|
+ // ------------------------------------ //
|
|
|
+ // if (self.arrayPos == 1){
|
|
|
+ // self.backDelay = 50;
|
|
|
+ // }
|
|
|
+ // else{ self.backDelay = 500; }
|
|
|
+
|
|
|
+ // contain typing function in a timeout humanize'd delay
|
|
|
+ self.timeout = setTimeout(function() {
|
|
|
+ // check for an escape character before a pause value
|
|
|
+ // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^
|
|
|
+ // single ^ are removed from string
|
|
|
+ var charPause = 0;
|
|
|
+ var substr = curString.substr(curStrPos);
|
|
|
+ if (substr.charAt(0) === '^') {
|
|
|
+ var skip = 1; // skip atleast 1
|
|
|
+ if(/^\^\d+/.test(substr)) {
|
|
|
+ substr = /\d+/.exec(substr)[0];
|
|
|
+ skip += substr.length;
|
|
|
+ charPause = parseInt(substr);
|
|
|
+ }
|
|
|
+
|
|
|
+ // strip out the escape character and pause value so they're not printed
|
|
|
+ curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);
|
|
|
+ }
|
|
|
+
|
|
|
+ // timeout for any pause after a character
|
|
|
+ self.timeout = setTimeout(function() {
|
|
|
+ if(curStrPos === curString.length) {
|
|
|
+ // fires callback function
|
|
|
+ self.options.onStringTyped(self.arrayPos);
|
|
|
+
|
|
|
+ // is this the final string
|
|
|
+ if(self.arrayPos === self.strings.length-1) {
|
|
|
+ // animation that occurs on the last typed string
|
|
|
+ self.options.callback();
|
|
|
+
|
|
|
+ self.curLoop++;
|
|
|
+
|
|
|
+ // quit if we wont loop back
|
|
|
+ if(self.loop === false || self.curLoop === self.loopCount)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ self.timeout = setTimeout(function(){
|
|
|
+ self.backspace(curString, curStrPos);
|
|
|
+ }, self.backDelay);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ /* call before functions if applicable */
|
|
|
+ if(curStrPos === 0)
|
|
|
+ self.options.preStringTyped(self.arrayPos);
|
|
|
+
|
|
|
+ // start typing each new char into existing string
|
|
|
+ // curString: arg, self.baseText: original text inside element
|
|
|
+ var nextString = self.baseText + curString.substr(0, curStrPos+1);
|
|
|
+ if (self.attr) {
|
|
|
+ self.el.attr(self.attr, nextString);
|
|
|
+ } else {
|
|
|
+ self.el.text(nextString);
|
|
|
+ }
|
|
|
+
|
|
|
+ // add characters one by one
|
|
|
+ curStrPos++;
|
|
|
+ // loop the function
|
|
|
+ self.typewrite(curString, curStrPos);
|
|
|
+ }
|
|
|
+ // end of character pause
|
|
|
+ }, charPause);
|
|
|
+
|
|
|
+ // humanized value for typing
|
|
|
+ }, humanize);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ , backspace: function(curString, curStrPos){
|
|
|
+ // exit when stopped
|
|
|
+ if (this.stop === true) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // varying values for setTimeout during typing
|
|
|
+ // can't be global since number changes each time loop is executed
|
|
|
+ var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed;
|
|
|
+ var self = this;
|
|
|
+
|
|
|
+ self.timeout = setTimeout(function() {
|
|
|
+
|
|
|
+ // ----- this part is optional ----- //
|
|
|
+ // check string array position
|
|
|
+ // on the first string, only delete one word
|
|
|
+ // the stopNum actually represents the amount of chars to
|
|
|
+
|
|
|
+// ------------- CUSTOM OPTIONS --------------------------------------------- //
|
|
|
+// ========================================================================== //
|
|
|
+// -------------------------------------------------------------------------- //
|
|
|
+ if (self.arrayPos == 1) {
|
|
|
+ self.stopNum = 17;
|
|
|
+ self.backDelay = 500;
|
|
|
+ }
|
|
|
+ else if (self.arrayPos == 2) {
|
|
|
+ self.stopNum = 54;
|
|
|
+ }
|
|
|
+ else{self.stopNum = 0;}
|
|
|
+
|
|
|
+ // ----- continue important stuff ----- //
|
|
|
+ // replace text with base text + typed characters
|
|
|
+ var nextString = self.baseText + curString.substr(0, curStrPos);
|
|
|
+ if (self.attr) {
|
|
|
+ self.el.attr(self.attr, nextString);
|
|
|
+ } else {
|
|
|
+ self.el.text(nextString);
|
|
|
+ }
|
|
|
+
|
|
|
+ // if the number (id of character in current string) is
|
|
|
+ // less than the stop number, keep going
|
|
|
+ if (curStrPos > self.stopNum){
|
|
|
+ // subtract characters one by one
|
|
|
+ curStrPos--;
|
|
|
+ // loop the function
|
|
|
+ self.backspace(curString, curStrPos);
|
|
|
+ }
|
|
|
+ // if the stop number has been reached, increase
|
|
|
+ // array position to next string
|
|
|
+ else if (curStrPos <= self.stopNum) {
|
|
|
+ self.arrayPos++;
|
|
|
+
|
|
|
+ if(self.arrayPos === self.strings.length) {
|
|
|
+ self.arrayPos = 0;
|
|
|
+ self.init();
|
|
|
+ } else
|
|
|
+ self.typewrite(self.strings[self.arrayPos], curStrPos);
|
|
|
+ }
|
|
|
+
|
|
|
+ // humanized value for typing
|
|
|
+ }, humanize);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // Start & Stop currently not working
|
|
|
+
|
|
|
+ // , stop: function() {
|
|
|
+ // var self = this;
|
|
|
+
|
|
|
+ // self.stop = true;
|
|
|
+ // clearInterval(self.timeout);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // , start: function() {
|
|
|
+ // var self = this;
|
|
|
+ // if(self.stop === false)
|
|
|
+ // return;
|
|
|
+
|
|
|
+ // this.stop = false;
|
|
|
+ // this.init();
|
|
|
+ // }
|
|
|
+
|
|
|
+ // Reset and rebuild the element
|
|
|
+ , reset: function(){
|
|
|
+ var self = this;
|
|
|
+ clearInterval(self.timeout);
|
|
|
+ var id = this.el.attr('id');
|
|
|
+ this.el.after('<span id="' + id + '"/>')
|
|
|
+ this.el.remove();
|
|
|
+ this.cursor.remove();
|
|
|
+ // Send the callback
|
|
|
+ self.options.resetCallback();
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ $.fn.typed = function (option) {
|
|
|
+ return this.each(function () {
|
|
|
+ var $this = $(this)
|
|
|
+ , data = $this.data('typed')
|
|
|
+ , options = typeof option == 'object' && option;
|
|
|
+ if (!data) $this.data('typed', (data = new Typed(this, options)));
|
|
|
+ if (typeof option == 'string') data[option]();
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $.fn.typed.defaults = {
|
|
|
+ strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"],
|
|
|
+ // typing speed
|
|
|
+ typeSpeed: 0,
|
|
|
+ // time before typing starts
|
|
|
+ startDelay: 0,
|
|
|
+ // backspacing speed
|
|
|
+ backSpeed: 0,
|
|
|
+ // time before backspacing
|
|
|
+ backDelay: 500,
|
|
|
+ // loop
|
|
|
+ loop: false,
|
|
|
+ // false = infinite
|
|
|
+ loopCount: false,
|
|
|
+ // show cursor
|
|
|
+ showCursor: true,
|
|
|
+ // character for cursor
|
|
|
+ cursorChar: "|",
|
|
|
+ // attribute to type (null == text)
|
|
|
+ attr: null,
|
|
|
+ // call when done callback function
|
|
|
+ callback: function() {},
|
|
|
+ // starting callback function before each string
|
|
|
+ preStringTyped: function() {},
|
|
|
+ //callback for every typed string
|
|
|
+ onStringTyped: function() {},
|
|
|
+ // callback for reset
|
|
|
+ resetCallback: function() {}
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+}(window.jQuery);
|
|
|
+
|
|
|
+
|
|
|
+/*global define:false require:false */
|
|
|
+(function (name, context, definition) {
|
|
|
+ if (typeof module != 'undefined' && module.exports) module.exports = definition();
|
|
|
+ else if (typeof define == 'function' && define.amd) define(definition);
|
|
|
+ else context[name] = definition();
|
|
|
+})('jquery-scrollto', this, function(){
|
|
|
+ // Prepare
|
|
|
+ var jQuery, $, ScrollTo;
|
|
|
+ jQuery = $ = window.jQuery || require('jquery');
|
|
|
+
|
|
|
+ // Fix scrolling animations on html/body on safari
|
|
|
+ $.propHooks.scrollTop = $.propHooks.scrollLeft = {
|
|
|
+ get: function(elem,prop) {
|
|
|
+ var result = null;
|
|
|
+ if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) {
|
|
|
+ if ( prop === 'scrollLeft' ) {
|
|
|
+ result = window.scrollX;
|
|
|
+ } else if ( prop === 'scrollTop' ) {
|
|
|
+ result = window.scrollY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( result == null ) {
|
|
|
+ result = elem[prop];
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = {
|
|
|
+ get: function(tween) {
|
|
|
+ return $.propHooks.scrollTop.get(tween.elem, tween.prop);
|
|
|
+ },
|
|
|
+ set: function(tween) {
|
|
|
+ // Our safari fix
|
|
|
+ if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) {
|
|
|
+ // Defaults
|
|
|
+ tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX);
|
|
|
+ tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY);
|
|
|
+
|
|
|
+ // Apply
|
|
|
+ if ( tween.prop === 'scrollLeft' ) {
|
|
|
+ tween.options.bodyScrollLeft = Math.round(tween.now);
|
|
|
+ }
|
|
|
+ else if ( tween.prop === 'scrollTop' ) {
|
|
|
+ tween.options.bodyScrollTop = Math.round(tween.now);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Apply
|
|
|
+ window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop);
|
|
|
+ }
|
|
|
+ // jQuery's IE8 Fix
|
|
|
+ else if ( tween.elem.nodeType && tween.elem.parentNode ) {
|
|
|
+ tween.elem[ tween.prop ] = tween.now;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // jQuery ScrollTo
|
|
|
+ ScrollTo = {
|
|
|
+ // Configuration
|
|
|
+ config: {
|
|
|
+ duration: 400,
|
|
|
+ easing: 'swing',
|
|
|
+ callback: undefined,
|
|
|
+ durationMode: 'each',
|
|
|
+ offsetTop: 0,
|
|
|
+ offsetLeft: 0
|
|
|
+ },
|
|
|
+
|
|
|
+ // Set Configuration
|
|
|
+ configure: function(options){
|
|
|
+ // Apply Options to Config
|
|
|
+ $.extend(ScrollTo.config, options||{});
|
|
|
+
|
|
|
+ // Chain
|
|
|
+ return this;
|
|
|
+ },
|
|
|
+
|
|
|
+ // Perform the Scroll Animation for the Collections
|
|
|
+ // We use $inline here, so we can determine the actual offset start for each overflow:scroll item
|
|
|
+ // Each collection is for each overflow:scroll item
|
|
|
+ scroll: function(collections, config){
|
|
|
+ // Prepare
|
|
|
+ var collection, $container, container, $target, $inline, position, containerTagName,
|
|
|
+ containerScrollTop, containerScrollLeft,
|
|
|
+ containerScrollTopEnd, containerScrollLeftEnd,
|
|
|
+ startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
|
|
|
+ startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
|
|
|
+ scrollOptions,
|
|
|
+ callback;
|
|
|
+
|
|
|
+ // Determine the Scroll
|
|
|
+ collection = collections.pop();
|
|
|
+ $container = collection.$container;
|
|
|
+ $target = collection.$target;
|
|
|
+ containerTagName = $container.prop('tagName');
|
|
|
+
|
|
|
+ // Prepare the Inline Element of the Container
|
|
|
+ $inline = $('<span/>').css({
|
|
|
+ 'position': 'absolute',
|
|
|
+ 'top': '0px',
|
|
|
+ 'left': '0px'
|
|
|
+ });
|
|
|
+ position = $container.css('position');
|
|
|
+
|
|
|
+ // Insert the Inline Element of the Container
|
|
|
+ $container.css({position:'relative'});
|
|
|
+ $inline.appendTo($container);
|
|
|
+
|
|
|
+ // Determine the top offset
|
|
|
+ startOffsetTop = $inline.offset().top;
|
|
|
+ targetOffsetTop = $target.offset().top;
|
|
|
+ targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);
|
|
|
+
|
|
|
+ // Determine the left offset
|
|
|
+ startOffsetLeft = $inline.offset().left;
|
|
|
+ targetOffsetLeft = $target.offset().left;
|
|
|
+ targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);
|
|
|
+
|
|
|
+ // Determine current scroll positions
|
|
|
+ containerScrollTop = $container.prop('scrollTop');
|
|
|
+ containerScrollLeft = $container.prop('scrollLeft');
|
|
|
+
|
|
|
+ // Reset the Inline Element of the Container
|
|
|
+ $inline.remove();
|
|
|
+ $container.css({position:position});
|
|
|
+
|
|
|
+ // Prepare the scroll options
|
|
|
+ scrollOptions = {};
|
|
|
+
|
|
|
+ // Prepare the callback
|
|
|
+ callback = function(event){
|
|
|
+ // Check
|
|
|
+ if ( collections.length === 0 ) {
|
|
|
+ // Callback
|
|
|
+ if ( typeof config.callback === 'function' ) {
|
|
|
+ config.callback();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // Recurse
|
|
|
+ ScrollTo.scroll(collections,config);
|
|
|
+ }
|
|
|
+ // Return true
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+
|
|
|
+ // Handle if we only want to scroll if we are outside the viewport
|
|
|
+ if ( config.onlyIfOutside ) {
|
|
|
+ // Determine current scroll positions
|
|
|
+ containerScrollTopEnd = containerScrollTop + $container.height();
|
|
|
+ containerScrollLeftEnd = containerScrollLeft + $container.width();
|
|
|
+
|
|
|
+ // Check if we are in the range of the visible area of the container
|
|
|
+ if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
|
|
|
+ targetOffsetTopAdjusted = containerScrollTop;
|
|
|
+ }
|
|
|
+ if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
|
|
|
+ targetOffsetLeftAdjusted = containerScrollLeft;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Determine the scroll options
|
|
|
+ if ( targetOffsetTopAdjusted !== containerScrollTop ) {
|
|
|
+ scrollOptions.scrollTop = targetOffsetTopAdjusted;
|
|
|
+ }
|
|
|
+ if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
|
|
|
+ scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Check to see if the scroll is necessary
|
|
|
+ if ( $container.prop('scrollHeight') === $container.width() ) {
|
|
|
+ delete scrollOptions.scrollTop;
|
|
|
+ }
|
|
|
+ if ( $container.prop('scrollWidth') === $container.width() ) {
|
|
|
+ delete scrollOptions.scrollLeft;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Perform the scroll
|
|
|
+ if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) {
|
|
|
+ $container.animate(scrollOptions, {
|
|
|
+ duration: config.duration,
|
|
|
+ easing: config.easing,
|
|
|
+ complete: callback
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+
|
|
|
+ // Return true
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // ScrollTo the Element using the Options
|
|
|
+ fn: function(options){
|
|
|
+ // Prepare
|
|
|
+ var collections, config, $container, container;
|
|
|
+ collections = [];
|
|
|
+
|
|
|
+ // Prepare
|
|
|
+ var $target = $(this);
|
|
|
+ if ( $target.length === 0 ) {
|
|
|
+ // Chain
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Handle Options
|
|
|
+ config = $.extend({},ScrollTo.config,options);
|
|
|
+
|
|
|
+ // Fetch
|
|
|
+ $container = $target.parent();
|
|
|
+ container = $container.get(0);
|
|
|
+
|
|
|
+ // Cycle through the containers
|
|
|
+ while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
|
|
|
+ // Check Container for scroll differences
|
|
|
+ var containerScrollTop, containerScrollLeft;
|
|
|
+ containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
|
|
|
+ containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
|
|
|
+ if ( containerScrollTop || containerScrollLeft ) {
|
|
|
+ // Push the Collection
|
|
|
+ collections.push({
|
|
|
+ '$container': $container,
|
|
|
+ '$target': $target
|
|
|
+ });
|
|
|
+ // Update the Target
|
|
|
+ $target = $container;
|
|
|
+ }
|
|
|
+ // Update the Container
|
|
|
+ $container = $container.parent();
|
|
|
+ container = $container.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Add the final collection
|
|
|
+ collections.push({
|
|
|
+ '$container': $('html'),
|
|
|
+ // document.body doesn't work in firefox, html works for all
|
|
|
+ // internet explorer starts at the beggining
|
|
|
+ '$target': $target
|
|
|
+ });
|
|
|
+
|
|
|
+ // Adjust the Config
|
|
|
+ if ( config.durationMode === 'all' ) {
|
|
|
+ config.duration /= collections.length;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Handle
|
|
|
+ ScrollTo.scroll(collections,config);
|
|
|
+
|
|
|
+ // Chain
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // Apply our extensions to jQuery
|
|
|
+ $.ScrollTo = $.ScrollTo || ScrollTo;
|
|
|
+ $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn;
|
|
|
+
|
|
|
+ // Export
|
|
|
+ return ScrollTo;
|
|
|
+});
|