html - jquerymobile pageinit() 页面隐藏?

标签 html jquery-mobile

var $page = el.parents('div[data-role="page"]:visible');

pageinit() 上调用对我来说显示为 null。有谁知道从 JQM 访问元素高度的适当处理程序? (因为我需要在显示元素时运行 height())

谢谢。

最佳答案

如果您想要在 jQuery Mobile 中引用当前显示的页面,可以使用 $.mobile.activePage属性(property)。它存储当前页面的 jQuery 对象。

所以要得到当前<div data-role="page">的高度你会做的元素:

var the_height = $.mobile.activePage.height();

或者您可以获得 <div data-role="content"> 的高度部分:

var the_height = $.mobile.activePage.children('[data-role="content"]').height();

这是文档中关于此的页面的链接(但是几乎没有关于此属性的信息,您可能仍想浏览该页面以查看 jQuery Mobile 内置的内容):http://jquerymobile.com/demos/1.0rc2/docs/api/methods.html

关于html - jquerymobile pageinit() 页面隐藏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8089917/

相关文章:

php - 在 mysql 数据库中存储 HTML 的最佳实践

javascript - 使用纯 css 从移动菜单切换到默认菜单

django - 将 HTML5 appCache 与 Django 动态页面一起使用

jquery - 根据移动应用程序的屏幕尺寸自动增大字体大小

javascript - 在 jQuery Mobile 中检测从边缘滑动

javascript - jQuery Mobile 可折叠 'expand' 事件未在 Cordova 应用程序中触发

javascript - JQuery Mobile 和 Cordova 页面模板

javascript - Bootstrap 导航栏事件状态不工作

java - 使用 Jsoup 从特定 html 源中提取值

jquery - iPhone jQuery : How to implement a Split view in iPad using Jquery Mobile + phone gap in iPhone