Jquery mobile “fixed”属性只能部分起作用。哈哈,有点晚了-希望你现在就可以开始了但是在我的解决方案中,没有必要在ajax调用中包含导航栏。。。您只需调用container div中的内容。此js将与您的ajax调用一起运行,并应用于container div上方的

Jquery mobile “fixed”属性只能部分起作用。哈哈,有点晚了-希望你现在就可以开始了但是在我的解决方案中,没有必要在ajax调用中包含导航栏。。。您只需调用container div中的内容。此js将与您的ajax调用一起运行,并应用于container div上方的,jquery-mobile,navigation,persistence,Jquery Mobile,Navigation,Persistence,“fixed”属性只能部分起作用。哈哈,有点晚了-希望你现在就可以开始了但是在我的解决方案中,没有必要在ajax调用中包含导航栏。。。您只需调用container div中的内容。此js将与您的ajax调用一起运行,并应用于container div上方的nav。非常灵活的解决方法,谢谢!不是针对个人的,但是我很犹豫是否将此标记为答案,因为我认为仍然存在导航栏行为不正确的问题(内容在其背后呈现),但尽管如此,我已经学会了一种很酷的技术,这无疑将在其他开发领域派上用场!哈哈,没问题。你所说的“在其


“fixed”属性只能部分起作用。哈哈,有点晚了-希望你现在就可以开始了但是在我的解决方案中,没有必要在ajax调用中包含导航栏。。。您只需调用container div中的内容。此js将与您的ajax调用一起运行,并应用于container div上方的nav。非常灵活的解决方法,谢谢!不是针对个人的,但是我很犹豫是否将此标记为答案,因为我认为仍然存在导航栏行为不正确的问题(内容在其背后呈现),但尽管如此,我已经学会了一种很酷的技术,这无疑将在其他开发领域派上用场!哈哈,没问题。你所说的“在其背后呈现内容”是什么意思?如果您的动态内容位于页眉下方(在z轴上),那么这更多是一个标记问题-与导航的活动状态无关。通常,(以及在我的页面的初始加载时)当导航栏处于“固定”状态时,它会呈现在页面顶部,而任何其他页面内容都会呈现在其下方(在y轴上)。但在我的情况下,当页面通过ajax重新加载时,navbar会浮动在页面内容之上,页面内容呈现在navbar之下(在z轴上)。。。这就是为什么我需要在页面内容的顶部包含
标记。这就像“固定”属性只起了部分作用。哈哈,有点晚了-希望你现在已经开始了但是在我的解决方案中,没有必要在ajax调用中包含导航栏。。。您只需调用container div中的内容即可。此js将与您的ajax调用一起运行,并应用于container div上方的nav。
<div data-role="page" id="settings" data-theme="a">
var htmlContent = $("#settings").html();
$("#settings").html(htmlContent); 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

<script type="text/javascript" charset="utf-8">

function loadSomeHTML() {
    var htmlContent = $("#settings").html();
    $("#settings").html(htmlContent); 
}

</script> 
    <div data-role="page" id="welcome" data-theme="a">
    <div data-role="header" data-position="fixed" data-id="TestPersist">
        <div data-theme="" data-role="navbar" data-iconpos="top">
            <ul>
                <li>
                    <a href="#schedule" id="navbar_schedule" data-theme="" data-icon="grid" class="navlink">
                        Schedules
                    </a>
                </li>
                <li>
                    <a href="#settings" id="navbar_settings" data-theme="" data-icon="gear" class="navlink">
                        Settings
                    </a>
                </li>
            </ul>
        </div>
    </div><!-- /header -->
    <div data-role="content" data-theme="">
        This is the welcome page
    </div><!-- /content -->
</div>

<div data-role="page" id="schedule" data-theme="a">
    <div data-role="header" data-position="fixed" data-id="TestPersist">
        <div data-theme="" data-role="navbar" data-iconpos="top">
            <ul>
                <li>
                    <a href="#schedule" id="navbar_schedule" data-theme="" data-icon="grid" class="navlink ui-btn-active ui-state-persist">
                        Schedules
                    </a>
                </li>
                <li>
                    <a href="#settings" id="navbar_settings" data-theme="" data-icon="gear" class="navlink">
                        Settings
                    </a>
                </li>
            </ul>
        </div>
    </div><!-- /header -->
    <div data-role="content" data-theme="">
        This is the sched page
        <input type="button" value="Replace content in settings page" onclick="loadSomeHTML();">
    </div><!-- /content -->
</div>

<div data-role="page" id="settings" data-theme="a">
    <div data-role="header" data-position="fixed" data-id="TestPersist">
        <div data-theme="" data-role="navbar" data-iconpos="top">
            <ul>
                <li>
                    <a href="#schedule" id="navbar_schedule" data-theme="" data-icon="grid" class="navlink">
                        Schedules
                    </a>
                </li>
                <li>
                    <a href="#settings" id="navbar_settings" data-theme="" data-icon="gear" class="navlink ui-btn-active ui-state-persist">
                        Settings
                    </a>
                </li>
            </ul>
        </div>
    </div><!-- /header -->
    <div data-role="content" data-theme="">
        <br><br><br><br><br><br><br>This is the settings page
    </div><!-- /content -->
</div>
<li><a href="javascript:;" id="nav_billing" class="panes" rel="#billing" data-role="button" data-theme="b" data-icon="minus" data-iconpos="right">Billing Info</a></li>
<li><a href="javascript:;" id="nav_shipping" class="panes" rel="#shipping" data-icon="minus" data-role="button" data-iconpos="right">Shipping Info</a></li>
<li><a href="javascript:;" id="nav_payment" class="panes" rel="#checkout" data-icon="minus" data-role="button" data-iconpos="right">Payment Info</a></li>
$( document ).bind( "mobileinit", function(){
$.mobile.button.prototype.options.initSelector = ".panes";
});
$('a').buttonMarkup({ theme: "a" });
// 100% untested and sure to not work as is 
$(".panes").on('click', function () {

// turn our clicked link into theme b aka active
$(this).buttonMarkup({ theme: "b" });

// works nice with icons too
$(this).buttonMarkup({ icon: "check" });

// grab all sibling links and turn them to theme a
// this probably won't work without accounting for the actual markup :)
$(this).siblings().buttonMarkup({ theme: "a" }); 

});