Skip to content

Commit

Permalink
Merge pull request #1269 from SergioCrisostomo/scroller-fix
Browse files Browse the repository at this point in the history
Scroller fix
  • Loading branch information
arian committed Jun 23, 2014
2 parents 43a2d89 + aeecaa0 commit 5f82f73
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
28 changes: 19 additions & 9 deletions Docs/Interface/Scroller.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Scroller Method: constructor

### Arguments

1. element - (*element*) The element to scroll.
1. element - (*mixed*) The element to scroll, or it's id.
2. options - (*object*, optional) An object for the Scroller instance's options.

#### Options :
Expand All @@ -47,15 +47,25 @@ Scroller Method: constructor

#### Examples

var myScroller = new Scroller(window, {
area: Math.round(window.getWidth() / 5)
new Element('div', {
styles: {
width: 600,
height: 400
}
}).inject(new Element('div', {
id: 'myScroll',
styles: {
width: 300,
height: 200,
overflow: 'scroll'
}
}).inject($(document.body)))


var myScroller = new Scroller('myScroll', {
area: Math.round(window.getWidth() / 10)
});

(function(){
this.stop();
this.start();
}).periodical(1000, myScroller);

myScroller.start();


Scroller Method: start {#Scroller:start}
Expand Down
2 changes: 1 addition & 1 deletion Source/Interface/Scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var Scroller = new Class({
scroll: function(){
var size = this.element.getSize(),
scroll = this.element.getScroll(),
pos = this.element != this.docBody ? this.element.getOffsets() : {x: 0, y:0},
pos = ((this.element != this.docBody) && (this.element != window)) ? element.getOffsets() : {x: 0, y: 0},
scrollSize = this.element.getScrollSize(),
change = {x: 0, y: 0},
top = this.options.area.top || this.options.area,
Expand Down

0 comments on commit 5f82f73

Please sign in to comment.