Sha256: 89253681506c8a9ccedc0cf35bda18b57628d27f09e9d3d4f1d64bd081ab81eb
Contents?: true
Size: 1.71 KB
Versions: 11
Compression:
Stored size: 1.71 KB
Contents
(function($) { // Only show scroll indicators if at least 20% of the panorama is // outside of the viewport. var minOverflowFraction = 1.2; // Ensure scroll indicators are already hidden when the scroller // decelerates while approaching the max scroll position. var margin = 40; $.widget('pageflow.linkmapScrollIndicators', { _create: function() { var scroller = this.options.scroller; this.arrows = this.element.find('.linkmap-arrow'); scroller.onScroll(_.bind(this.refresh, this)); scroller.onScrollEnd(_.bind(this.refresh, this)); this.refresh(); if (this.options.disabled) { this.disable(); } }, refresh: function() { var element = this.element; var scroller = this.options.scroller; var viewport = this.options.viewport; var innerScrollerElement = this.options.innerScrollerElement; var showH = innerScrollerElement.width() / viewport.width() > minOverflowFraction; var showV = innerScrollerElement.height() / viewport.height() > minOverflowFraction; element.toggleClass('can_scroll_left', showH && Math.ceil(scroller.positionX()) < - margin); element.toggleClass('can_scroll_right', showH && Math.floor(scroller.positionX()) > scroller.maxX() + margin); element.toggleClass('can_scroll_up', showV && Math.ceil(scroller.positionY()) < - margin); element.toggleClass('can_scroll_down', showV && Math.floor(scroller.positionY()) > scroller.maxY() + margin); }, disable: function() { this.arrows.hide(); }, enable: function() { this.arrows.show(); } }); }(jQuery));
Version data entries
11 entries across 11 versions & 1 rubygems