JQuery过滤使用引导列
JQuery Filtering Using Bootstrap Columns
所以我有这个工作小提琴:https://jsfiddle.net/p5ahob32/1/
$('#filter').keyup(function () {
var filter = $(this).val(), count = 0;
$('.col-md-3 a').each(function () {
// If the list item does not contain the text phrase fade it out
if ($(this).text().search(new RegExp(filter, "i")) < 0) {
$(this).fadeOut();
// Show the list item if the phrase matches and increase the count by 1
} else {
$(this).show();
count++;
}
});
// Update the count
var numberItems = count;
$("#filter-count").text("Number of Clients = " + count);
});
如果你在搜索框中输入3,它会淡出所有其他按钮,除了3,但是你会注意到3按钮一直在右边,因为它在bootstrap列中。
我的问题是我如何使它,使所有的搜索项目将出现堆叠在一起很好在左上角?
谢谢!
删除<a>
的所有行,除了包含所有cols的外部行和隐藏父行
$(this).parent().fadeOut();
//AND
$(this).parent().show()
演示// change
$(this).fadeOut();
// to
$(this).parent().css("display","none");
// or
$(this).parent().fadeOut()
相关文章:
- 使用jquery grep过滤具有值数组的json对象
- 如何使用javascript、jquery或其他javascript框架过滤数据
- 使用jquery过滤逗号分隔的span文本
- jquery对标记类型和id进行过滤
- jQuery只过滤可见元素
- 停止 jQuery 自动完成以过滤/搜索结果并填充整个源数组数据
- 如何在BlueImp jQuery下载程序中过滤要下载的文件
- 在 Android WebView 中过滤 DOM 元素,而无需 jQuery
- 多个复选框过滤,JavaScript和jQuery
- 使用jQuery过滤两种输入类型
- 使用jquery从json过滤搜索
- jQuery Mobile-过滤复选框的列表视图会导致出现无样式的复选框
- 如何动态过滤jQuery移动选择表单
- 过滤jQuery数据表的负整数
- 任何过滤jquery数据的选项,比如linq中的. Any()
- 使用filter()基于父元素过滤jquery
- 使用过滤jquery隐藏表行
- 过滤jQuery可排序的项目
- 过滤jquery输入中的名称
- 过滤JQuery列表与URL