开发者

webOS Horizontal Scroller not working

I'm still trying to figure out why this isn't working and I'm at the end of my rope. Every different method I've tried always takes me back to the zero position.

Here's what my code looks like:

function MainAssistant(argFromPusher) {
}

MainAssistant.prototype = {
   setup: function() {
      Ares.setupSceneAssistant(this);
      Mojo.Event.listen(this.controller.get('scrollto'), Mojo.Event.tap, this.scrolltoTap.bindAsEventListener(this));
      this.controller.setupWidget("scrollerId", {
                   mode: 'horizontal-snap'
               }, this.model = {
                开发者_开发知识库   snapElements: { x: $$('.scrollerItem') },
                   snapIndex: 0
               }
        );
   },

   cleanup: function() {
      Ares.cleanupSceneAssistant(this);
   }
};

MainAssistant.prototype.scrolltoTap = function(singleTapEvent){
   //this.controller.get('scrollerId').mojo.scrollTo(1024, undefined, false, false);   
   Mojo.Log.info('SCROLL POSITION---');
   var sc = this.controller.get('scrollerId');
   Mojo.Log.info(sc.mojo.getScrollPosition().left);
   sc.mojo.scrollTo(-2048);
   Mojo.Log.info('New SCROLL POSITION---');
   Mojo.Log.info(sc.mojo.getScrollPosition().left);
}

And here's what the output looks like when I click the scrollTo link.

com.example.pptest Info: SCROLL POSITION---, palmInitFramework367:2569
com.example.pptest Info: -1024, palmInitFramework367:2569
com.example.pptest Info: New SCROLL POSITION---, palmInitFramework367:2569
com.example.pptest Info: -2048, palmInitFramework367:2569
com.example.pptest =========> Calling palmInitFramework367, file:///usr/palm/frameworks/mojo/mojo.js:142
com.example.pptest Info: Requested submission : 367, palmInitFramework367:2569
com.example.pptest Info: Current locale is en_us, palmInitFramework367:2569
com.example.pptest Info: About to activate scene  main, palmInitFramework367:2569
com.example.pptest Info: Transition ended., palmInitFramework367:25

However it always ends up back at the zero position every time. Can anyone please help me with where I'm messing up? This is really frustrating.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜