/*! easyscroll v.1.0 | copyright (c) 2013 atomxml.org * demo, download: http://atomxml.org/demo_easyscroll * licensed under the mit license (http://atomxml.org/demo_easyscroll/mit-license.txt). */ !function(a,b,c){a.fn.scroll_absolute=function(d){function e(d,e){function f(b){var e,h,j,l,m,n,q= !1,r= !1;if(p=b,q===c)m=d.scrolltop(),n=d.scrollleft(),d.css({overflow:"hidden",padding:0}),r=d.innerwidth()+tb,s=d.innerheight(),d.width(r),q=a('
').css("padding",sb).append(d.children()),t=a('
').css({width:r+"px",height:s+"px"}).append(q).appendto(d);else{if(d.css("width",""),q=p.sticktobottom&&c(),r=p.sticktoright&&d(),l=d.innerwidth()+tb!=r||d.outerheight()!=s,l&&(r=d.innerwidth()+tb,s=d.innerheight(),t.css({width:r+"px",height:s+"px"})),!l&&ub==u&&q.outerheight()==v)return d.width(r),void 0;ub=u,q.css("width",""),d.width(r),t.find(">.scroll_vertical_bar,>.scroll_horizontal_bar").remove().end()}q.css("overflow","auto"),u=b.contentwidth?b.contentwidth:q[0].scrollwidth,v=q[0].scrollheight,q.css("overflow",""),w=u/r,x=v/s,y=x>1,z=w>1,z||y?(d.addclass("easy_scrollable"),e=p.maintainposition&&(ab||db),e&&(h=a(),j=b()),g(),i(),k(),e&&(y(r?u-r:h,!1),x(q?v-s:j,!1)),h(),e(),n(),p.enablekeyboardnavigation&&j(),p.clickontrack&&o(),l(),p.hijackinternallinks&&m()):(d.removeclass("easy_scrollable"),q.css({top:0,left:0,width:t.width()-tb}),f(),i(),k(),p()),p.autoreinitialise&& !rb?rb=setinterval(function(){f(p)},p.autoreinitialisedelay): !p.autoreinitialise&&rb&&clearinterval(rb),m&&d.scrolltop(0)&&x(m,!1),n&&d.scrollleft(0)&&y(n,!1),d.trigger("easy-initialised",[z||y])}function g(){y&&(t.append(a('
').append(a('
'),a('
').append(a('
').append(a('
'),a('
'))),a('
'))),eb=t.find(">.scroll_vertical_bar"),fb=eb.find(">.scroll_track"),$=fb.find(">.scroll_drag"),p.arrows&&(jb=a('').bind("mousedown.easy",m(0,-1)).bind("click.easy",g),kb=a('').bind("mousedown.easy",m(0,1)).bind("click.easy",g),p.arrowscrollonhover&&(jb.bind("mouseover.easy",m(0,-1,jb)),kb.bind("mouseover.easy",m(0,1,kb))),l(fb,p.verticalarrowpositions,jb,kb)),hb=s,t.find(">.scroll_vertical_bar>.scroll_cap:visible,>.scroll_vertical_bar>.scroll_arrow").each(function(){hb-=a(this).outerheight()}),$.hover(function(){$.addclass("easy_hover")},function(){$.removeclass("easy_hover")}).bind("mousedown.easy",function(b){a("html").bind("dragstart.easy selectstart.easy",g),$.addclass("easy_active");var c=b.pagey-$.position().top;return a("html").bind("mousemove.easy",function(a){r(a.pagey-c,!1)}).bind("mouseup.easy mouseleave.easy",q),!1}),h())}function h(){fb.height(hb+"px"),ab=0,gb=p.verticalgutter+fb.outerwidth(),q.width(r-gb-tb);try{0===eb.position().left&&q.css("margin-left",gb+"px")}catch(a){}}function i(){z&&(t.append(a('
').append(a('
'),a('
').append(a('
').append(a('
'),a('
'))),a('
'))),lb=t.find(">.scroll_horizontal_bar"),mb=lb.find(">.scroll_track"),bb=mb.find(">.scroll_drag"),p.arrows&&(pb=a('
').bind("mousedown.easy",m(-1,0)).bind("click.easy",g),qb=a('').bind("mousedown.easy",m(1,0)).bind("click.easy",g),p.arrowscrollonhover&&(pb.bind("mouseover.easy",m(-1,0,pb)),qb.bind("mouseover.easy",m(1,0,qb))),l(mb,p.horizontalarrowpositions,pb,qb)),bb.hover(function(){bb.addclass("easy_hover")},function(){bb.removeclass("easy_hover")}).bind("mousedown.easy",function(b){a("html").bind("dragstart.easy selectstart.easy",g),bb.addclass("easy_active");var c=b.pagex-bb.position().left;return a("html").bind("mousemove.easy",function(a){t(a.pagex-c,!1)}).bind("mouseup.easy mouseleave.easy",q),!1}),nb=t.innerwidth(),j())}function j(){t.find(">.scroll_horizontal_bar>.scroll_cap:visible,>.scroll_horizontal_bar>.scroll_arrow").each(function(){nb-=a(this).outerwidth()}),mb.width(nb+"px"),db=0}function k(){if(z&&y){var b=mb.outerheight(),c=fb.outerwidth();hb-=b,a(lb).find(">.scroll_cap:visible,>.scroll_arrow").each(function(){nb+=a(this).outerwidth()}),nb-=c,s-=c,r-=b,mb.parent().append(a('
').css("width",b+"px")),h(),j()}z&&q.width(t.outerwidth()-tb+"px"),v=q.outerheight(),x=v/s,z&&(ob=math.ceil(1/w*nb),ob>p.horizontaldragmaxwidth?ob=p.horizontaldragmaxwidth:obp.verticaldragmaxheight?ib=p.verticaldragmaxheight:ibg)ab-k>c?vb.scrollbyy(-f):r(c);else{if(!(g>0))return j(),void 0;c>ab+k?vb.scrollbyy(f):r(c)}d=settimeout(i,h?p.initialdelay:p.trackclickrepeatfreq),h= !1},j=function(){d&&cleartimeout(d),d=null,a(document).unbind("mouseup.easy",j)};return i(),a(document).bind("mouseup.easy",j),!1}}),z&&mb.bind("mousedown.easy",function(b){if(b.originaltarget===c||b.originaltarget==b.currenttarget){var d,e=a(this),f=e.offset(),g=b.pagex-f.left-db,h= !0,i=function(){var a=e.offset(),c=b.pagex-a.left-ob/2,f=r*p.scrollpagepercent,k=cb*f/(u-r);if(0>g)db-k>c?vb.scrollbyx(-f):t(c);else{if(!(g>0))return j(),void 0;c>db+k?vb.scrollbyx(f):t(c)}d=settimeout(i,h?p.initialdelay:p.trackclickrepeatfreq),h= !1},j=function(){d&&cleartimeout(d),d=null,a(document).unbind("mouseup.easy",j)};return i(),a(document).bind("mouseup.easy",j),!1}})}function p(){mb&&mb.unbind("mousedown.easy"),fb&&fb.unbind("mousedown.easy")}function q(){a("html").unbind("dragstart.easy selectstart.easy mousemove.easy mouseup.easy mouseleave.easy"),$&&$.removeclass("easy_active"),bb&&bb.removeclass("easy_active")}function r(a,b){y&&(0>a?a=0:a>_&&(a=_),b===c&&(b=p.animatescroll),b?vb.animate($,"top",a,s):($.css("top",a),s(a)))}function s(a){a===c&&(a=$.position().top),t.scrolltop(0),ab=a;var b=0===ab,e=ab==_,f=a/_,g= -f*(v-s);(wb!=b||yb!=e)&&(wb=b,yb=e,d.trigger("easy-arrow-change",[wb,yb,xb,zb])),v(b,e),q.css("top",g),d.trigger("easy-scroll-y",[-g,b,e]).trigger("scroll")}function t(a,b){z&&(0>a?a=0:a>cb&&(a=cb),b===c&&(b=p.animatescroll),b?vb.animate(bb,"left",a,u):(bb.css("left",a),u(a)))}function u(a){a===c&&(a=bb.position().left),t.scrolltop(0),db=a;var b=0===db,e=db==cb,f=a/cb,g= -f*(u-r);(xb!=b||zb!=e)&&(xb=b,zb=e,d.trigger("easy-arrow-change",[wb,yb,xb,zb])),w(b,e),q.css("left",g),d.trigger("easy-scroll-x",[-g,b,e]).trigger("scroll")}function v(a,b){p.arrows&&(jb[a?"addclass":"removeclass"]("scroll_disabled"),kb[b?"addclass":"removeclass"]("scroll_disabled"))}function w(a,b){p.arrows&&(pb[a?"addclass":"removeclass"]("scroll_disabled"),qb[b?"addclass":"removeclass"]("scroll_disabled"))}function x(a,b){var c=a/(v-s);r(c*_,b)}function y(a,b){var c=a/(u-r);t(c*cb,b)}function z(b,c,d){var e,f,g,h,i,j,k,l,m,n=0,o=0;try{e=a(b)}catch(p){return}for(f=e.outerheight(),g=e.outerwidth(),t.scrolltop(0),t.scrollleft(0);!e.is(".scroll_absolute");)if(n+=e.position().top,o+=e.position().left,e=e.offsetparent(),/^body|html$/i.test(e[0].nodename))return;h=b(),j=h+s,h>n||c?l=n-p.verticalgutter:n+f>j&&(l=n-s+f+p.verticalgutter),isnan(l)||x(l,d),i=a(),k=i+r,i>o||c?m=o-p.horizontalgutter:o+g>k&&(m=o-r+g+p.horizontalgutter),isnan(m)||y(m,d)}function a(){return-q.position().left}function b(){return-q.position().top}function c(){var a=v-s;return a>20&&a-b()<10}function d(){var a=u-r;return a>20&&a-a()<10}function e(){t.unbind(bb).bind(bb,function(a,b,c,d){var e=db,f=ab;return vb.scrollby(c*p.mousewheelspeed,-d*p.mousewheelspeed,!1),e==db&&f==ab})}function f(){t.unbind(bb)}function g(){return!1}function h(){q.find(":input,a").unbind("focus.easy").bind("focus.easy",function(a){z(a.target,!1)})}function i(){q.find(":input,a").unbind("focus.easy")}function j(){function b(){var a=db,b=ab;switch(c){case 40:vb.scrollbyy(p.keyboardspeed,!1);break;case 38:vb.scrollbyy(-p.keyboardspeed,!1);break;case 34:case 32:vb.scrollbyy(s*p.scrollpagepercent,!1);break;case 33:vb.scrollbyy(-s*p.scrollpagepercent,!1);break;case 39:vb.scrollbyx(p.keyboardspeed,!1);break;case 37:vb.scrollbyx(-p.keyboardspeed,!1)}return e=a!=db||b!=ab}var c,e,f=[];z&&f.push(lb[0]),y&&f.push(eb[0]),q.focus(function(){d.focus()}),d.attr("tabindex",0).unbind("keydown.easy keypress.easy").bind("keydown.easy",function(d){if(d.target===this||f.length&&a(d.target).closest(f).length){var g=db,h=ab;switch(d.keycode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:c=d.keycode,b();break;case 35:x(v-s),c=null;break;case 36:x(0),c=null}return e=d.keycode==c&&g!=db||h!=ab,!e}}).bind("keypress.easy",function(a){return a.keycode==c&&b(),!e}),p.hidefocus?(d.css("outline","none"),"hidefocus"in t[0]&&d.attr("hidefocus",!0)):(d.css("outline","none"),"hidefocus"in t[0]&&d.attr("hidefocus",!1))}function k(){d.attr("tabindex","-1").removeattr("tabindex").unbind("keydown.easy keypress.easy")}function l(){if(location.hash&&location.hash.length>1){var b,c,d=escape(location.hash.substr(1));try{b=a("#"+d+', a[name="'+d+'"]')}catch(e){return}b.length&&q.find(d)&&(0===t.scrolltop()?c=setinterval(function(){t.scrolltop()>0&&(z(b,!0),a(document).scrolltop(t.position().top),clearinterval(c))},50):(z(b,!0),a(document).scrolltop(t.position().top)))}}function m(){a(document.body).data("easy_hijack")||(a(document.body).data("easy_hijack",!0),a(document.body).delegate("a[href*=#]","click",function(c){var d,e,f,g,h,i,j=this.href.substr(0,this.href.indexof("#")),k=location.href;if(-1!==location.href.indexof("#")&&(k=location.href.substr(0,location.href.indexof("#"))),j===k){d=escape(this.href.substr(this.href.indexof("#")+1));try{e=a("#"+d+', a[name="'+d+'"]')}catch(l){return}e.length&&(f=e.closest(".easy_scrollable"),g=f.data("easy"),g.scrolltoelement(e,!0),f[0].scrollintoview&&(h=a(b).scrolltop(),i=e.offset().top,(h>i||i>h+a(b).height())&&f[0].scrollintoview()),c.preventdefault())}}))}function n(){var a,b,c,d,e,f= !1;t.unbind("touchstart.easy touchmove.easy touchend.easy click.easy-touchclick").bind("touchstart.easy",function(g){var h=g.originalevent.touches[0];a=a(),b=b(),c=h.pagex,d=h.pagey,e= !1,f= !0}).bind("touchmove.easy",function(g){if(f){var h=g.originalevent.touches[0],i=db,j=ab;return vb.scrollto(a+c-h.pagex,b+d-h.pagey),e=e||math.abs(c-h.pagex)>5||math.abs(d-h.pagey)>5,i==db&&j==ab}}).bind("touchend.easy",function(){f= !1}).bind("click.easy-touchclick",function(){return e?(e= !1,!1):void 0})}function o(){var a=b(),b=a();d.removeclass("easy_scrollable").unbind(".easy"),d.replacewith(ab.append(q.children())),ab.scrolltop(a),ab.scrollleft(b),rb&&clearinterval(rb)}var p,q,r,s,t,u,v,w,x,y,z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb=this,wb= !0,xb= !0,yb= !1,zb= !1,ab=d.clone(!1,!1).empty(),bb=a.fn.mwheelintent?"mwheelintent.easy":"mousewheel.easy";sb=d.css("padding-top")+" "+d.css("padding-right")+" "+d.css("padding-bottom")+" "+d.css("padding-left"),tb=(parseint(d.css("padding-left"),10)||0)+(parseint(d.css("padding-right"),10)||0),a.extend(vb,{reinitialise:function(b){b=a.extend({},p,b),f(b)},scrolltoelement:function(a,b,c){z(a,b,c)},scrollto:function(a,b,c){y(a,c),x(b,c)},scrolltox:function(a,b){y(a,b)},scrolltoy:function(a,b){x(a,b)},scrolltopercentx:function(a,b){y(a*(u-r),b)},scrolltopercenty:function(a,b){x(a*(v-s),b)},scrollby:function(a,b,c){vb.scrollbyx(a,c),vb.scrollbyy(b,c)},scrollbyx:function(a,b){var c=a()+math[0>a?"floor":"ceil"](a),d=c/(u-r);t(d*cb,b)},scrollbyy:function(a,b){var c=b()+math[0>a?"floor":"ceil"](a),d=c/(v-s);r(d*_,b)},positiondragx:function(a,b){t(a,b)},positiondragy:function(a,b){r(a,b)},animate:function(a,b,c,d){var e={};e[b]=c,a.animate(e,{duration:p.animateduration,easing:p.animateease,queue: !1,step:d})},getcontentpositionx:function(){return a()},getcontentpositiony:function(){return b()},getcontentwidth:function(){return u},getcontentheight:function(){return v},getpercentscrolledx:function(){return a()/(u-r)},getpercentscrolledy:function(){return b()/(v-s)},getisscrollableh:function(){return z},getisscrollablev:function(){return y},getcontentpane:function(){return q},scrolltobottom:function(a){r(_,a)},hijackinternallinks:a.noop,destroy:function(){o()}}),f(e)}return d=a.extend({},a.fn.scroll_absolute.defaults,d),a.each(["arrowbuttonspeed","trackclickspeed","keyboardspeed"],function(){d[this]=d[this]||d.speed}),this.each(function(){var b=a(this),c=b.data("easy");c?c.reinitialise(d):(a("script",b).filter('[type="text/javascript"],:not([type])').remove(),c=new e(b,d),b.data("easy",c))})},a.fn.scroll_absolute.defaults={arrows: !1,maintainposition: !0,sticktobottom: !1,sticktoright: !1,clickontrack: !0,autoreinitialise: !1,autoreinitialisedelay:500,verticaldragminheight:0,verticaldragmaxheight:99999,horizontaldragminwidth:0,horizontaldragmaxwidth:99999,contentwidth:c,animatescroll: !1,animateduration:300,animateease:"linear",hijackinternallinks: !1,verticalgutter:4,horizontalgutter:4,mousewheelspeed:150,arrowbuttonspeed:0,arrowrepeatfreq:200,arrowscrollonhover: !1,trackclickspeed:0,trackclickrepeatfreq:70,verticalarrowpositions:"split",horizontalarrowpositions:"split",enablekeyboardnavigation: !0,hidefocus: !1,keyboardspeed:0,initialdelay:300,speed:30,scrollpagepercent:.8}}(jquery,this); /*! copyright (c) 2013 brandon aaron (http://brandonaaron.net) * licensed under the mit license (license.txt). * * thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * thanks to: mathias bank(http://www.mathias-bank.de) for a scope bug fix. * thanks to: seamus leahy for adding deltax and deltay * * version: 3.1.3 * * requires: 1.2.2+ */ (function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){module.exports=factory;}else{factory(jquery);}}(function($){var tofix=['wheel','mousewheel','dommousescroll','mozmousepixelscroll'];var tobind='onwheel'in document||document.documentmode>=9?['wheel']:['mousewheel','dommousescroll','mozmousepixelscroll'];var lowestdelta,lowestdeltaxy;if($.event.fixhooks){for(var i=tofix.length;i;){$.event.fixhooks[tofix[--i]]=$.event.mousehooks;}}$.event.special.mousewheel={setup:function(){if(this.addeventlistener){for(var i=tobind.length;i;){this.addeventlistener(tobind[--i],handler,false);}}else{this.onmousewheel=handler;}},teardown:function(){if(this.removeeventlistener){for(var i=tobind.length;i;){this.removeeventlistener(tobind[--i],handler,false);}}else{this.onmousewheel=null;}}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel");},unmousewheel:function(fn){return this.unbind("mousewheel",fn);}});function handler(event){var orgevent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltax=0,deltay=0,absdelta=0,absdeltaxy=0,fn;event=$.event.fix(orgevent);event.type="mousewheel";if(orgevent.wheeldelta){delta=orgevent.wheeldelta;}if(orgevent.detail){delta=orgevent.detail* -1;}if(orgevent.deltay){deltay=orgevent.deltay* -1;delta=deltay;}if(orgevent.deltax){deltax=orgevent.deltax;delta=deltax* -1;}if(orgevent.wheeldeltay!==undefined){deltay=orgevent.wheeldeltay;}if(orgevent.wheeldeltax!==undefined){deltax=orgevent.wheeldeltax* -1;}absdelta=math.abs(delta);if(!lowestdelta||absdelta0?'floor':'ceil';delta=math[fn](delta/lowestdelta);deltax=math[fn](deltax/lowestdeltaxy);deltay=math[fn](deltay/lowestdeltaxy);args.unshift(event,delta,deltax,deltay);return($.event.dispatch||$.event.handle).apply(this,args);}}));