Jquery mobile splitview $.mobile.changePage 不起作用
您好,我正在使用库中给出的 Jquery mobile splitview https://github.com/asyraf9/jquery-mobile/。
我在左侧面板 A 和 B 中有两个页面,在右侧面板中有两个页面 C 和 D。 最初我分别在左侧面板和右侧面板中渲染页面 A 和 C。现在,单击链接时,我想将左侧面板从 A 更改为 B,将右侧面板中的 C 更改为 D
更改并不完全有效,它仅更改左侧面板,而不更改右侧面板中放置上述锚点的页面。
请注意,上面的链接或按钮始终出现在右窗格中。如果我使用
Hi I am using Jquery mobile splitview as given in the libraryhttps://github.com/asyraf9/jquery-mobile/.
I have two pages in the left A and B panel and two pages C and D in the right panel.
Initially I render page A and C in left and right panel respectively. Now on click on a link I want to change the left panel from A to B and in right panel C to D
Change is not working completely its only changing the left panel not the page in right panel where the above anchor is placed.
Note that the link or button above is present in the right pane always. If I use
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
单击链接/任何触发 splitview 更改的操作后执行 .refresh() 。
do a .refresh() after link click/anything that triggers the change in the splitview.
splitview 中有一个上下文加载选项。为什么不使用这个呢?
我找不到示例页面了,但我在脚本中使用相同的逻辑,所以...如果您找不到它,请尝试如下操作:
1)为您的链接提供上下文属性:
2)监听单击这些上下文链接,如下所示:
3)在某处放置上下文函数:
4)添加 JQM findclosestLink 函数(我忘记了)
您的链接将触发第一个changePage,您的上下文函数将触发第二个changePage。根据您使用它的位置,您的上下文changePage调用还将触发另一个hashChange事件,JQM可能不会阻止该事件(每个changePage还会触发一个hashChange,该事件被JQM使用ignoreNextHashChange阻止 - 检查源)。
因此,在进行第二次调用后,您可能必须执行类似的操作以确保 hashChange 被阻止:
整个事情都在我的 multiview 插件,但是该插件尚未完成,有 bug,我最近没有时间处理它。不过 Context 正在工作,所以您可以将其取出并根据需要使用它。
干杯!
there is a context loading option in splitview. Why not use this?
I can't find the sample page anymore, but I'm using the same logic in my script, so... if you can't find it, try something like this:
1) give your links context attributes:
2) Listen for clicks on these context links like so:
3) Put a context function somewhere:
4) Add the JQM findclosestLink function (I forgot)
Your link will fire the first changePage, your context function will fire the second changePage. Depending on where you use this, your context changePage call will also trigger another hashChange event, which JQM may not block (every changePage also fires a hashChange which is blocked by JQM using ignoreNextHashChange - check the source).
So you may have to do something like this after making your second call to ensure the hashChange is blocked:
The whole thing is working inside my multiview plugin, BUT the plugin is not finished, buggy and I haven't had the time to work on it lately. Context is working though, so you might just pull it out and use it as you need.
Cheers!