Rails 3 - will_paginate 隐藏类“next_page 已禁用”和“上一页已禁用”
我试图做到这一点,以便如果没有更多页面可以链接到,则下一页和上一页链接不会与 will_paginate gem 一起显示。
如果没有任何内容可链接到,则 will_paginate 会为跨度“next_page 已禁用”分配一个特殊的类,而不是简单的 next_page。
我尝试不使用 CSS: 来显示它,
.next_page disabled {
display: none;
}
并尝试使用 %20:
.next_page%20disabled {
无论如何,有谁知道一个简单的 with 来禁用这些链接(如果它们不执行任何操作)?
谢谢
I'm trying to make it so the next and previous page links do not display with the will_paginate gem if there are no more pages they can link to.
will_paginate assigns a special class to the span "next_page disabled" rather than the simple next_page if there is nothing to link to.
I tried just not displaying it with CSS:
.next_page disabled {
display: none;
}
and tried with %20:
.next_page%20disabled {
Anyway, does anyone know of a simple with to disable these links if they don't do anything?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 .next_page.disabled - 甚至只是 .disabled - 应该可以。您可以为单个元素指定多个类,这就是您在这里看到的。
Try .next_page.disabled - or even just .disabled - that should work. You can specify multiple classes for a single element, and that's what you're seeing here.
如果您想定位具有两个类的对象(并且仅当两个类都存在时),您应该使用:
多个类只需用句号连接。
华泰
If you want to target an object with two classes (and only when both classes are present) you should use:
Multiple classes are simply joined with a full stop.
HTH