更新时间:2023-09-03 22:45:40
这是一个有效的示例: http://jsfiddle.net/Gajotres/HCcUe/
Here's a working example: http://jsfiddle.net/Gajotres/HCcUe/
和代码示例:
$(document).on('pagebeforeshow', '#index', function(){
$('[data-role="header"]').attr({'data-fullscreen':'true','data-position':'fixed'}).html('<h3>Test</h3>');
$('#index').trigger('pagecreate');
});
使用pageshow或pagebeforeshow页面事件来设置此属性.另外,不要在jQuery Mobile中使用准备就绪的文档,在这里您会找到原因: https://***.com/a/14469041/1848600
Use pageshow or pagebeforeshow page event to set this attributes. Also do not use document ready with jQuery Mobile, here you will find why: https://***.com/a/14469041/1848600