ContentFlow javascript - reloading images after filtering
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!
You may use an array to store all your images' info and then use ContentFlow's addItem()
and rmItem()
functions depending on the filter condition and the array.
With this approach you could reload the flow dynamically from the array items.
精彩评论