我仍在试图弄清楚为什么这不起作用,而且我已经走到了尽头。我尝试过的每一种不同的方法总是让我回到零位。
这是我的代码的样子:
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
然而,它总是每次都回到零位。任何人都可以帮我解决我搞砸的地方吗?这真是令人沮丧。