/** Ace custom scroller. It is not as feature-rich as plugins such as NiceScroll but it's good enough for most cases. */ (function($ , undefined) { var Ace_Scroll = function(element , _settings) { var self = this; var settings = $.extend({}, $.fn.ace_scroll.defaults, _settings); this.size = 0; this.$element = $(element); this.element = element; var vertical = true; var disabled = false; var active = false; var created = false; var $content_wrap = null, content_wrap = null; var $track = null, $bar = null, track = null, bar = null; var bar_style = null; var bar_size = 0, bar_pos = 0, bar_max_pos = 0, bar_size_2 = 0, move_bar = true; var reset_once = false; var css_pos, css_size, max_css_size, client_size, scroll_direction, scroll_size; var ratio = 1; var inline_style = false; var mouse_track = false; var mouse_release_target = 'onmouseup' in window ? window : 'html'; var dragEvent = settings.dragEvent || false; var trigger_scroll = _settings.scrollEvent || false; this.create = function(_settings) { if(created) return; //if(disabled) return; if(_settings) settings = $.extend({}, $.fn.ace_scroll.defaults, _settings); this.size = parseInt(this.$element.attr('data-size')) || settings.size || 200; vertical = !settings['horizontal']; css_pos = vertical ? 'top' : 'left';//'left' for horizontal css_size = vertical ? 'height' : 'width';//'width' for horizontal max_css_size = vertical ? 'maxHeight' : 'maxWidth'; client_size = vertical ? 'clientHeight' : 'clientWidth'; scroll_direction = vertical ? 'scrollTop' : 'scrollLeft'; scroll_size = vertical ? 'scrollHeight' : 'scrollWidth'; this.$element.addClass('ace-scroll '+((vertical? '' : ' scroll-hz') + (settings.styleClass ? ' '+settings.styleClass : ''))); if(this.$element.css('position') == 'static') { inline_style = this.element.style.position; this.element.style.position = 'relative'; } else inline_style = false; this.$element.wrapInner('
'); this.$element.prepend('