我有一个多列布局,其中“#content-primary”是div,我想要加载实际内容,而“#content-secondary”包含生成的链接列表视图导航菜单)。在JQuery Mobile的div容器中打开链接
我使用此代码来更改页面,几乎跟随JQM文档,但浏览器正在跟随到全新页面的链接,而不是将它们的内容加载到“#content-primary”div 。显然有一些我错过了。
$(function(){
$('#menu a').click(function() {
$.mobile.changePage($(this).attr('href'), {
pageContainer: $("#content-primary")
});
});
});
在后端使用Django,但它可能不相关。
$ .mobile.changePage()可以从外部调用,并接受以下参数(于过渡,回,changeHash)。是什么让你认为你可以通过一个页面容器? – Tsar
根据文档(http://jquerymobile.com/test/docs/api/methods.html),它有两个参数:changePage(to,options)其中options是一组属性。 pageContainer是这些属性之一。 [quote] pageContainer(jQuery集合,\t默认:$ .mobile.pageContainer)指定应该包含页面的元素。[/ quote] – sw00