更改 jQuery Mobile 过渡方向

发布于 2024-12-29 18:40:26 字数 181 浏览 2 评论 0原文

我正在开发一个 Web 应用程序,我决定使用 jQuery Mobile。问题是我的网站是波斯语,这是一种从右到左的语言。我创建了一个 rtl.css 样式表,它可以反转所有内容,但我还需要反转默认的幻灯片转换,这意味着它应该从左向右滑动,并且在添加数据反转或后退按钮时它应该从右向左滑动。

你能帮我解决这个问题吗?
谢谢。

I'm working on a web app, which I decided to use jQuery Mobile for it. The problem is my website is in Persian language which is a Right-to-Left language. I've created an rtl.css stylesheet which reverses everything, but I need to also reverse default slide transitions, meaning that it should slide from left to right and when adding data-reverse or back button it should slide right to left.

Can you please help me with this?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

潦草背影 2025-01-05 18:40:26

您可以在此处查看文档

在你的情况下,你应该这样写:

$.mobile.changePage( "nextPage.html", {
    transition: "slide",
    reverse: true
});

另一种方法
您可以在链接中使用data-direction 属性。

示例:

<a href="nextPage.html" data-transition="slide", data-direction: "reverse">Next page</a>

我认为您可以通过这种方式全局设置它:您可以在 jQuery Mobile JS 中找到以下语句:

a.mobile.changePage.defaults

在该行,您可以将 reverse:false 更改为 reverse:true

You can check the documentation here.

In your case, you should put this :

$.mobile.changePage( "nextPage.html", {
    transition: "slide",
    reverse: true
});

There is another method:
You can use the data-direction attribute in the link.

Exemple :

<a href="nextPage.html" data-transition="slide", data-direction: "reverse">Next page</a>

I think that you can set it globally in that way : you can find the following statement in the jQuery Mobile JS :

a.mobile.changePage.defaults

At that line, you can change reverse:false to reverse:true.

恬淡成诗 2025-01-05 18:40:26

对于标记来说,这似乎提供了更好的幻灯片效果,并且也更符合 jQuery Mobile 在其文档中所做的事情。

<a href="#main" data-transition="slide" data-direction="reverse">

For markup, this seems to provide for a better slide effect and also more in-line with what jQuery Mobile does in their docs.

<a href="#main" data-transition="slide" data-direction="reverse">
烟燃烟灭 2025-01-05 18:40:26

我认为没有全局选项,但您可以迭代所有页面并添加属性

data-direction="reverse"

jQM 文档:

但 @Zakaria 也是一个有效的响应

I don't think there is a Global option but you could iterate through all the page and add the attribute

data-direction="reverse"

jQM Docs:

but @Zakaria is also a valid response

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文