/*! hamster-wheel - v1.0.0 - 2016-06-20 * Copyright (c) 2016 Polar Notion; Licensed MIT */ !function(a){a.fn.hamsterWheel=function(b){"use strict";function c(a){for(var b=0;a>b;b++)i.clone(!0).appendTo(h)}function d(){k=h.outerHeight(!0),l=h.offset(),o=Math.round(k+l.top-n)}function e(a){c(a),g.infinite&&d(),g.autoscroll&&q()}var f,g=a.extend({},a.fn.hamsterWheel.defaults,b),h=a(this),i=h.children().first(),j=i.height(),k=h.outerHeight(!0),l=h.offset(),m=0,n=window.innerHeight,o=Math.round(k+l.top-window.innerHeight),p=g.scrollSpeed;if(g.scrollbar===!1&&a("body").append(""),g.autoscroll)var q=function(){window.scrollBy(0,1),f=setTimeout(q,p)},r=function(){window.scrollBy(0,-1),f=setTimeout(r,p)};return g.infinite&&a(window).scroll(function(){var b=a(this).scrollTop();b>m&&b>=o?a(document).scrollTop(l.top+j-n):m>b&&b<=l.top&&a(document).scrollTop(o-j+n);var c=g.scrollDelta;if(Math.abs(m-b)>=c&&Math.abs(m-b)<200&&g.autoscroll===!0)if(b>m)clearTimeout(f),q();else{if(!(m>b))return!1;clearTimeout(f),r()}m=b}),e(g.clones),a(window).resize(function(){d()}),this},a.fn.hamsterWheel.defaults={autoscroll:!0,infinite:!0,scrollSpeed:40,scrollDelta:15,clones:6,scrollbar:!1}}(jQuery);