public/libraries.js
function (scrollBy, animation) {
            var pages = this.pages,
              pageCount = pages.length,
              currentPage = this.currentPage + scrollBy,
              clipHeight = this.clipHeight,
              navOptions = this.options.navigation,
              activeColor = navOptions.activeColor,
              inactiveColor = navOptions.inactiveColor,
              pager = this.pager,
              padding = this.padding,
              scrollOffset;

            // When resizing while looking at the last page
            if (currentPage > pageCount) {
                currentPage = pageCount;
            }

            if (currentPage > 0) {

                if (animation !== UNDEFINED) {
                    setAnimation(animation, this.chart);
                }

                this.nav.attr({
                    translateX: padding,
                    translateY: clipHeight + this.padding + 7 + this.titleHeight,
                    visibility: VISIBLE
                });
                this.up.attr({
                      fill: currentPage === 1 ? inactiveColor : activeColor
                  })
                  .css({
                      cursor: currentPage === 1 ? 'default' : 'pointer'
                  });
                pager.attr({
                    text: currentPage + '/' + pageCount
                });
                this.down.attr({
                      x: 18 + this.pager.getBBox().width, // adjust to text width
                      fill: currentPage === pageCount ? inactiveColor : activeColor
                  })
                  .css({
                      cursor: currentPage === pageCount ? 'default' : 'pointer'
                  });

                scrollOffset = -pages[currentPage - 1] + this.initialItemY;

                this.scrollGroup.animate({
                    translateY: scrollOffset
                });

                this.currentPage = currentPage;
                this.positionCheckboxes(scrollOffset);
            }

        }
function (scrollBy, animation) {
            var pages = this.pages,
              pageCount = pages.length,
              currentPage = this.currentPage + scrollBy,
              clipHeight = this.clipHeight,
              navOptions = this.options.navigation,
              activeColor = navOptions.activeColor,
              inactiveColor = navOptions.inactiveColor,
              pager = this.pager,
              padding = this.padding,
              scrollOffset;

            // When resizing while looking at the last page
            if (currentPage > pageCount) {
                currentPage = pageCount;
            }

            if (currentPage > 0) {

                if (animation !== UNDEFINED) {
                    setAnimation(animation, this.chart);
                }

                this.nav.attr({
                    translateX: padding,
                    translateY: clipHeight + this.padding + 7 + this.titleHeight,
                    visibility: VISIBLE
                });
                this.up.attr({
                      fill: currentPage === 1 ? inactiveColor : activeColor
                  })
                  .css({
                      cursor: currentPage === 1 ? 'default' : 'pointer'
                  });
                pager.attr({
                    text: currentPage + '/' + pageCount
                });
                this.down.attr({
                      x: 18 + this.pager.getBBox().width, // adjust to text width
                      fill: currentPage === pageCount ? inactiveColor : activeColor
                  })
                  .css({
                      cursor: currentPage === pageCount ? 'default' : 'pointer'
                  });

                scrollOffset = -pages[currentPage - 1] + this.initialItemY;

                this.scrollGroup.animate({
                    translateY: scrollOffset
                });

                this.currentPage = currentPage;
                this.positionCheckboxes(scrollOffset);
            }

        }
function ( scrollBy , animation ) { var pages = this . pages , pageCount = pages . length , currentPage = this . currentPage + scrollBy , clipHeight = this . clipHeight , navOptions = this . options . navigation , activeColor = navOptions . activeColor , inactiveColor = navOptions . inactiveColor , pager = this . pager , padding = this . padding , scrollOffset ; // When resizing while looking at the last page if ( currentPage > pageCount ) { currentPage = pageCount ; } if ( currentPage > 0 ) { if ( animation !== UNDEFINED ) { setAnimation ( animation , this . chart ) ; } this . nav . attr ( { translateX : padding , translateY : clipHeight + this . padding + 7 + this . titleHeight , visibility : VISIBLE } ) ; this . up . attr ( { fill : currentPage === 1 ? inactiveColor : activeColor } ) . css ( { cursor : currentPage === 1 ? 'default' : 'pointer' } ) ; pager . attr ( { text : currentPage + '/' + pageCount } ) ; this . down . attr ( { x : 18 + this . pager . getBBox ( ) . width , // adjust to text width fill : currentPage === pageCount ? inactiveColor : activeColor } ) . css ( { cursor : currentPage === pageCount ? 'default' : 'pointer' } ) ; scrollOffset = - pages [ currentPage - 1 ] + this . initialItemY ; this . scrollGroup . animate ( { translateY : scrollOffset } ) ; this . currentPage = currentPage ; this . positionCheckboxes ( scrollOffset ) ; } }
Scroll the legend by a number of pages
@param {Object} scrollBy
@param {Object} animation
Scroll the legend by a number of pages