jquery 移动分组复选框搜索过滤器

标签 jquery css jquery-mobile

我想要带有搜索过滤器的垂直分组复选框。

有没有办法将常规搜索过滤器列表设置为看起来像垂直分组的复选框?

我可以将搜索过滤器添加到复选框组吗?

示例开始:http://jsfiddle.net/NwbZu/

最佳答案

您可以使用 CSS 将 listview 压缩到更小的空间:

/*remove background color from search input*/
.ui-listview-filter {
    background : none;
}
/*remove the vertical padding, background gradient, and border for each list-item*/
#dataPointList .ui-li {
    padding    : 0px 15px;
    background : none;
    border     : none;
}
/*remove the margin from the check-box container*/
#dataPointList .ui-li .ui-checkbox {
    margin : 0;
}
/*remove the rounded corners from all of the .ui-btn elements*/
#dataPointList .ui-li .ui-checkbox .ui-btn-corner-all {
    -webkit-border-radius : 0;
    -moz-border-radius    : 0;
    border-radius         : 0;
}
/*re-add the rounded corners (top only) for the first list-item element*/
#dataPointList .ui-li:first-child .ui-checkbox .ui-btn-corner-all {
    -webkit-border-top-left-radius  : 1em;
    -moz-border-top-left-radius     : 1em;
    border-top-left-radius          : 1em;
    -webkit-border-top-right-radius : 1em;
    -moz-border-top-right-radius    : 1em;
    border-top-right-radius         : 1em;
}
/*re-add the rounded corners (bottom only) for the last list-item element*/
#dataPointList .ui-li:last-child .ui-checkbox .ui-btn-corner-all {
    -webkit-border-bottom-left-radius  : 1em;
    -moz-border-bottom-left-radius     : 1em;
    border-bottom-left-radius          : 1em;
    -webkit-border-bottom-right-radius : 1em;
    -moz-border-bottom-right-radius    : 1em;
    border-bottom-right-radius         : 1em;
}

这是一个演示:http://jsfiddle.net/NwbZu/2/

当您搜索时,这不会更新列表,例如,如果您在演示中搜索 6,您将只会得到一个元素,并且不会更新为所有 Angular 都为圆 Angular 。但是,您可以使用 JS 实现此目的(我不确定您是否可以在 CSS 中仅对可见元素进行选择)。

如果您有任何问题,请告诉我。

关于jquery 移动分组复选框搜索过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9007576/

相关文章:

html - 当我在表单标签中放置一个类属性时,我的 'style.css' 文件不起作用

css - 如何引用 CSS children

javascript - 使所有表的列与第一个表的列具有相同的宽度

jquery-mobile - 通过 JQuery Mobile 动态添加按钮

html - Jquery Mobile 重定向或更改 url 时,页面没有任何 css

php - 无法通过jquery ajax向mysql添加内容

c# - MVC 中通过 Ajax 发送多个数组

php - div 文本未使用 css 正确定位?

javascript - Jquery 动画不服从 delay()

javascript - 如何关闭预先选择任何现有文本的默认文本框行为?