我發現這個插件修復WP反彈科爾多瓦: https://github.com/vilic/cordova-plugin-fix-wp-bouncing修復WP彈彈IBM MobileFirst 6.3
我要實現的插件安裝到我的MFP項目。
本機代碼:
void border_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) {
browser.InvokeScript("eval", "FixWPBouncing.onmanipulationcompleted()");
}
JavaScript代碼:
exports.onmanipulationcompleted = function() {
exports.target = null;
};
exports.fix = function (target) {
if (!POINTER_DOWN) { return; }
if (!(target instanceof HTMLElement) && target.length) {
target = target[0];
}
target.addEventListener(POINTER_DOWN, function() { exports.target = target; }, false); };
的plugin.xml:
<js-module src="www/fix-wp-bouncing.js" name="fix-wp-bouncing">
<clobbers target="FixWPBouncing" />
</js-module>
<!-- windows phone 8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="FixWPBouncing">
<param name="wp-package" value="FixWPBouncing"/>
<param name="onload" value="true" />
</feature>
</config-file>
如何撥打:
// call fix after deviceready.
var wrapper = document.getElementById('an-element-that-scrolls');
FixWPBouncing.fix(wrapper);
// I don’t have any idea where i must write this code below :
declare module FixWPBouncing {
/** when target is a JQuery, it process the first element only. */
export function fix(target: HTMLElement|JQuery): void;
}
從上面的代碼,這是我的解釋:
call FixWPBouncing.fix(wrapper);
=>它將調用javascript函數exports.fix,此功能的目的是增加事件偵聽器,當我們觸摸元件。在本地代碼
void border_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
監聽器將觸發JavaScript代碼exports.onmanipulationcompleted
<param name="onload" value="true" />
=>此配置的目的,是自動加載的本機代碼,所以我不需要調用cordova.exec
正因爲如此,我認爲整合JavaScript代碼和本地代碼,我將需要:
<js-module src="www/fix-wp-bouncing.js" name="fix-wp-bouncing">
<clobbers target="FixWPBouncing" />
</js-module>
所以本地代碼監聽器將始終觸發JavaScript代碼。
因爲從該鏈接,我們調用本機與cordova.exec。 不支持自動加載並自動觸發JavaScript代碼。 如果我錯了,請糾正我。
您是否有任何想法在MFP項目中實施:https://github.com/vilic/cordova-plugin-fix-wp-bouncing?