使用 jQuery Mobile 创建 iOS 页面指示器(点)

发布于 2024-10-25 17:51:01 字数 468 浏览 1 评论 0原文

//我对角落里可爱的女士的问题
我想创建一个分页来指示哪个页面可见,就像在 iOS 中一样(窗口下方的那些小点,在 HIG 中称为“页面指示器”。

) net/ZoETt.png" alt="chunky bacon">

-- 我的项目特此称为“殿下”。

我找到了一个示例,但找不到有关重新创建布局的文档,它位于实验部分:( http://jquerymobile .com/test/experiments/scrollview/#../../docs/toolbars/footer-persist-a.html

// my Question to the lovely lady in the corner

I would like to create a pagination for indicating what page is visible, like in iOS, (those little dots below a window, known as "page indicators" in the HIG.)

chunky bacon

-- My project is hereby referred to as, Her Highness.

I found an example, but I can't find documentation on re-creating the layout, and it's in the experiment section :(
http://jquerymobile.com/test/experiments/scrollview/#../../docs/toolbars/footer-persist-a.html

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

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

发布评论

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

评论(2

风追烟花雨 2024-11-01 17:51:01

我不知道为什么这对你来说似乎很难,但如果你正在谈论如何用 html/css3 制作圆圈,那么我有一个简单的答案。只需使点的边框半径等于高度/宽度的一半即可。

<span class="dot dot1"></span>
<span class="dot dot2"></span>
<span class="dot dot3"></span>
<span class="dot dot4"></span>

...

.dot {
    display: inline-block;
    width:12px;height:12px;
    border-radius:6px;
    background-color:#8999A6;
}
.page4 .dot4 {
    background-color: white;
}

如果您不知道除此之外该怎么做,您基本上需要有人为您做所有事情,但我会给您一个提示。在更高的地方,您将设置一个指示活动页面的类。这将允许您触发 CSS 规则,该规则可以说明哪个匹配点处于活动状态,并将背景更改为白色。

I'm not sure why this is the part that seems hard to you, but if you're talking about how to make circles with html/css3, then I've got a simple answer. Just make your dots with a border radius equal to half the height/width.

<span class="dot dot1"></span>
<span class="dot dot2"></span>
<span class="dot dot3"></span>
<span class="dot dot4"></span>

...

.dot {
    display: inline-block;
    width:12px;height:12px;
    border-radius:6px;
    background-color:#8999A6;
}
.page4 .dot4 {
    background-color: white;
}

If you can't figure out what to do beyond that, you're going to basically need someone to do the whole thing for you, but I'll give you a hint. Somewhere higher up, you're going to set a class indicating the active page. That will allow you to trigger CSS rules that could say which matching dot is active, and change the bg to white.

孤千羽 2024-11-01 17:51:01

在阅读了罗素的回答下的讨论后,我想我明白你想要什么。

  1. 创建一个持久的页脚。这不是一件小事,但却是可以做到的。
    您可以查看我的两列布局插件 http://jquerymobiledictionary.dyndns.org/dualColumn.html
    或者等我在周末处理这个问题时考虑您的问题(我建议您:P)。

  2. 获得持久页脚后,您可以从页面列表中生成点,然后处理 pageshow 事件以突出显示正确的点。

将整个内容封装在小部件代码中将使其成为渐进式增强,而不是一堆会激怒非 Agrade 浏览器用户的混乱代码。

After reading the discussion under Russel's answer I think I understand what You want.

  1. Create a presistent footer. That's not a trivial thing to do, but can be done.
    You can take a look at my plugin for two column layouts http://jquerymobiledictionary.dyndns.org/dualColumn.html
    or wait for me to take your issue into account while I work on it during the weekend (,which I advise you to :P).

  2. After you got the presistent footer you can generate the dots from the list of pages and then handle a pageshow event to highlight the correct dot.

Wrapping the whole thing in a widget code would allow it to be a progressive enhancement, not a messy pile of code that would iritate users with nonAgrade browsers.

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