ContentFlow javascript - 过滤后重新加载图像
我正在使用以下“Coverflow”javascript,ContentFlow
并具有过滤器功能来搜索内容流中的图像标题并过滤它们。我需要 Contentflow 在搜索功能之后重新加载过滤后的图像。我有以下代码,可用于过滤和重新加载“流”,但它会重新加载所有图像,而不是过滤后的图像。显然,我没有正确的代码来执行此操作,并且我需要一些帮助来加载过滤后的图像。
$("#filter").keyup(function(){
global.canChangeImage = true;
// Retrieve the input field text and reset the count to zero
var filter = $(this).val(), count = 0;
// Loop through the comment list
$("a.item").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();
var contentFlow = new ContentFlow('contentFlow');
contentFlow._init();
count++;
}
});
// Update the count
var numberItems = count;
$("#filter-count").text(count+" Images Found");
});
任何帮助将不胜感激!
I am using the following "Coverflow" javascript, ContentFlow
and have a filter function to search the Contentflow for image titles and filter them. I need the Contentflow to reload with the filtered images after the search function. I have the following code which works for filtering and reloading the "flow" but it reloads all the images, not the filtered images. Obviously, I don't have the right code to do this and I need a bit of help to get the filtered images loaded.
$("#filter").keyup(function(){
global.canChangeImage = true;
// Retrieve the input field text and reset the count to zero
var filter = $(this).val(), count = 0;
// Loop through the comment list
$("a.item").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();
var contentFlow = new ContentFlow('contentFlow');
contentFlow._init();
count++;
}
});
// Update the count
var numberItems = count;
$("#filter-count").text(count+" Images Found");
});
Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用数组来存储所有图像的信息,然后使用 ContentFlow 的 < code>addItem() 和
rmItem()
函数取决于过滤条件和数组。通过这种方法,您可以从数组项动态地重新加载流。
You may use an array to store all your images' info and then use ContentFlow's
addItem()
andrmItem()
functions depending on the filter condition and the array.With this approach you could reload the flow dynamically from the array items.