data-role="page"
jQuery Mobile を使用して (AJAX 経由で) ロードされたページに新しい JS インクルードを導入するには、各ページのまたは ( ) 要素内にそれらのファイルへの参照が必要です。これは、data-role="dialog"
jQuery Mobile が AJAX ページのロード中にこれらの要素の外側で何も処理しないためです。
または、JavaScript を使用してscript
、各ページ遷移の「pageshow」イベントで新しいタグを動的に作成することもできます。このようなもの:
$(document).on('pageshow', 'div[data-role*="page"],div[data-role*="dialog"]', function () {
(function () {
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
script.src = '/path/to/new/include.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
})();
});