Skip to content

Commit

Permalink
allow default position when instantiating iscroll
Browse files Browse the repository at this point in the history
  • Loading branch information
clkao committed Aug 30, 2011
1 parent 0ee66e8 commit 59f7af6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/iscroll.js
Expand Up @@ -60,6 +60,8 @@ var m = Math,
that.options = {
hScroll: true,
vScroll: true,
x: 0,
y: 0,
bounce: true,
bounceLock: false,
momentum: true,
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 59f7af6

Please sign in to comment.