我仍在试图弄清楚为什么这不起作用而且我已经走到了尽头。我尝试的每种不同方法总是把我带回零位。
以下是我的代码:
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);
}
这是单击scrollTo链接时输出的样子。
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
然而,每次它总是回到零位置。任何人都可以帮我解决我搞乱的问题吗?这真是令人沮丧。