Permalink
Browse files

Hide scroller when container is resized to be bigger than the content.

  • Loading branch information...
1 parent 8f24c1a commit b41e4e0b751f64d5472a72726cb0fb7ca4091bf7 @reimund committed Aug 13, 2012
Showing with 17 additions and 5 deletions.
  1. +17 −5 jquery.scroll.js
View
@@ -458,23 +458,35 @@ Changelog:
// repaint scrollbar height and position
//
repaint: function(){
- this.setHandleContainerSize();
+ this.setHandleContainerSize();
this.setHandle();
this.setHandlePosition();
},
- //
- // update the height of the handleContainer
- //
+ //
+ // update the height of the handleContainer
+ //
setHandleContainerSize: function() {
this.props.containerHeight = this.container.height();
+ // hide the scroller if the content height is lower than the
+ // container height
+ if(this.props.contentHeight <= this.props.containerHeight) {
+ this.handleContainer.hide();
+ this.handleArrowDown.hide();
+ this.handleArrowUp.hide();
+ } else {
+ this.handleContainer.show();
+ this.handleArrowDown.show();
+ this.handleArrowUp.show();
+ }
+
this.handleContainer.css({
'position': 'absolute',
'top': this.handleArrowUp.outerHeight(true),
'height': (this.props.containerHeight - this.handleArrowUp.outerHeight(true) - this.handleArrowDown.outerHeight(true)) + 'px'
});
- },
+ },
//

0 comments on commit b41e4e0

Please sign in to comment.