Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #109 from clkao/master

allow default position when instantiating iscroll
  • Loading branch information...
commit 423eea696dc864fb4b969c1a36c9e29eade0793b 2 parents 19db1db + 59f7af6
@cubiq cubiq authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/iscroll.js
View
7 src/iscroll.js
@@ -60,6 +60,8 @@ var m = Math,
that.options = {
hScroll: true,
vScroll: true,
+ x: 0,
+ y: 0,
bounce: true,
bounceLock: false,
momentum: true,
@@ -105,6 +107,7 @@ var m = Math,
// User defined options
for (i in options) that.options[i] = options[i];
+ that.x = that.options.x; that.y = that.options.y;
// Normalize options
that.options.useTransform = hasTransform ? that.options.useTransform : false;
@@ -119,8 +122,8 @@ var m = Math,
that.scroller.style[vendor + 'TransformOrigin'] = '0 0';
if (that.options.useTransition) that.scroller.style[vendor + 'TransitionTimingFunction'] = 'cubic-bezier(0.33,0.66,0.66,1)';
- if (that.options.useTransform) that.scroller.style[vendor + 'Transform'] = trnOpen + '0,0' + trnClose;
- else that.scroller.style.cssText += ';position:absolute;top:0;left:0';
+ if (that.options.useTransform) that.scroller.style[vendor + 'Transform'] = trnOpen + that.x + ',' + that.y + trnClose;
+ else that.scroller.style.cssText += ';position:absolute;top:'+that.y+';left:'+that.x;
if (that.options.useTransition) that.options.fixedScrollbar = true;
Please sign in to comment.
Something went wrong with that request. Please try again.