/** * jquery.scrollable 0.11. Making HTML elements scroll. * * http://flowplayer.org/tools/scrollable.html * * Copyright (c) 2008 Tero Piirainen (tero@flowplayer.org) * * Released under the MIT License: * http://www.opensource.org/licenses/mit-license.php * * >> Basically you can do anything you want but leave this header as is << * * Since : 0.01 - 03/01/2008 * Version: 0.11 - 05/20/2008 */ (function($){$.fn.extend({scrollable:function(b,c,d){return this.each(function(){if(typeof b=="string"){var a=$.data(this,"scrollable");a[b].apply(a,[c,d])}else{new $.scrollable(this,b,c)}})}});$.scrollable=function(a,b){$.data(a,"scrollable",this);this.init(a,b)};$.extend($.scrollable.prototype,{init:function(e,f){var g=this;var h={size:5,horizontal:false,activeClass:'active',speed:300,onSeek:null,items:'.items',prev:'.prev',next:'.next',navi:'.navi',naviItem:'span'};this.opts=$.extend(h,f);var j=this.root=$(e);var k=$(h.items,j);if(!k.length)k=j;k.css({position:'relative',overflow:'hidden',visibility:'visible'});k.children().wrapAll('
');this.wrap=k.children(":first");this.wrap.css(h.horizontal?"width":"height","200000em").after('
');this.items=this.wrap.children();this.index=0;if(h.horizontal){k.width(h.size*(this.items.eq(1).offset().left-this.items.eq(0).offset().left)-2)}else{k.height(h.size*(this.items.eq(1).offset().top-this.items.eq(0).offset().top)-2)}if($.isFunction($.fn.mousewheel)){j.bind("mousewheel.scrollable",function(a,b){g.move(-b,50);return false})}$(window).bind("keypress.scrollable",function(a){if($(a.target).parents(".__scrollable").length){if(h.horizontal&&(a.keyCode==37||a.keyCode==39)){g.move(a.keyCode==37?-1:1);return false}if(!h.horizontal&&(a.keyCode==38||a.keyCode==40)){g.move(a.keyCode==38?-1:1);return false}}return true});this.items.each(function(a,b){$(this).bind("click.scrollable",function(){g.click(a)})});this.activeIndex=0;$(h.prev,j).click(function(){g.prev()});$(h.next,j).click(function(){g.next()});$(h.navi,j).each(function(){var b=$(this);var c=g.getStatus();if(b.is(":empty")){for(var i=0;i").attr("page",i).click(function(){var a=$(this);a.parent().children().removeClass(h.activeClass);a.addClass(h.activeClass);g.setPage(a.attr("page"))});if(i==0)d.addClass(h.activeClass);b.append(d)}}else{b.children().each(function(i){var a=$(this);a.attr("page",i);if(i==0)a.addClass(h.activeClass);a.click(function(){a.parent().children().removeClass(h.activeClass);a.addClass(h.activeClass);g.setPage(a.attr("page"))})})}})},click:function(a){var b=this.items.eq(a);var c=this.opts.activeClass;if(!b.hasClass(c)&&(a>=0||a