我还没有找到过滤器搜索栏变慢的解决方法,但是,如果您从 UL LI 列表中删除所有锚标记和角色,这将删除数百个减慢页面加载和转换的绑定。然后你必须添加一个函数:
// should be defined in your body onload method, or pageinit
$("li").on("click", function(event) {
// determine your URI here you want to load
// ...
$.mobile.changePage(uri);
}; // if list dividers exist, add code to ignore them, or get page load error.
更新:根据文档,如果您将以下内容添加到 mobileinit,搜索子字符串将应用于正在搜索的单词的开头:
$.mobile.listview.prototype.options.filterCallback = function( text, searchValue ) {
return text.toLowerCase().substring( 0, searchValue.length ) !== searchValue;
};
注意:这仍然不能完全加快搜索栏的速度。由于即时搜索和 DOM 更新,按退格键特别慢。我没有看到解决此问题的 API 挂钩(还没有?)...它可能需要修改库。
另外:stackoverflow 的代码验证器过于挑剔,所以我省略了细节,比如显式的 mobileinit 代码...
更新:如果您开始使用 CSS3 过渡并遇到问题,请考虑以下...
如果您在 iOS 上遇到由于 GPU 的平铺渲染引擎在转换后没有 vsync-ing 而导致的渲染瑕疵,以下可能会有所帮助:
<style type="text/css">
html, body { -webkit-transform: translateZ(0); }
</style>