Sha256: 2d0c674045b6dbc17e275740250e9819594de8ac99572352546c91d97f008a60

Contents?: true

Size: 1.31 KB

Versions: 26

Compression:

Stored size: 1.31 KB

Contents

// Simple view for scrolling purposes.
// Uses two special options for setting scroll bar behavior:
//  - scrollX: true | false | 'auto'
//  - scrollY: true | false | 'auto'
var//RSence.Views
HScrollView = HControl.extend({
  controlDefaults: HControlDefaults.extend({
    scrollX: true,
    scrollY: true
  }),
  scrollToTop: function(){
    ELEM.get(this.elemId).scrollTop = 0;
  },
  scrollToBottom: function(){
    var
    elem = ELEM.get( this.elemId ),
    contentHeight = ELEM.getScrollSize(this.elemId)[1],
    viewHeight = this.rect.height;
    elem.scrollTop = contentHeight-viewHeight;
  },
  drawSubviews: function(){
    if(this.options.scrollX === 'auto' || this.options.scrollY === 'auto'){
      this.setStyle('overflow','auto');
    }
    else if(this.options.scrollX || this.options.scrollY){
      this.setStyle('overflow','scroll');
    }
    if(!this.options.scrollX){
      this.setStyle('overflow-x','hidden');
    }
    else if(this.options.scrollX === 'auto'){
      this.setStyle('overflow-x','auto');
    }
    else {
      this.setStyle('overflow-x','scroll');
    }
    if(!this.options.scrollY){
      this.setStyle('overflow-y','hidden');
    }
    else if(this.options.scrollY === 'auto'){
      this.setStyle('overflow-y','auto');
    }
    else {
      this.setStyle('overflow-y','scroll');
    }
  }
});

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rsence-pre-2.3.0.22 js/views/scrollview/scrollview.js
rsence-pre-2.3.0.21 js/views/scrollview/scrollview.js
rsence-pre-2.3.0.20 js/views/scrollview/scrollview.js
rsence-pre-2.3.0.19 js/views/scrollview/scrollview.js
rsence-pre-2.3.0.18 js/views/scrollview/scrollview.js
rsence-pre-2.3.0.17 js/views/scrollview/scrollview.js