我按照本指南开始了一个带有Phonegap的Adroid项目:http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android
滚动较长页面时会产生令人不快的效果:滚动结束时突出显示(覆盖页眉和页脚)和小弹跳(使固定位置页眉和页脚也反弹).
有没有办法在Android上使用Phonegap的这种实现来防止 - 弹跳和突出显示?我见过仅适用于嵌入式WebView的解决方案.
这是一个抽象的JavaScript代码示例,它说明了导致我在这里提出问题的情况:
function className (){
var private_variable = 0;
function privateMethod(){
// Some irrelevant code.
};
this.privilegedMethod = function (){
// Some relevant code to determine if private variable needs to be modified.
private_variable+=val; // Modifies private variable.
};
this.init = function () {
$(window).keydown(function (key) {
if (key.which == 13) {
privateMethod(); // Call to private method works fine.
this.privilegedMethod(); // 'this' references Window object,
// not this class method as expected.
}
});
};
};
Run Code Online (Sandbox Code Playgroud)
我的问题是 - 有没有另一种方法可以调用this.privilegedMethod()引用它的类,而不是它应用的Window对象?
或者也许任何建议如何重构我保持功能的代码 …