Я использую owlCarousel, и я добавил поисковую систему, но мне нужно обновить точки и элементы навигации для них.
Перед фильтрацией:
After filtering, I want that the dots are also updated and when clicking on the right nav or left nav, do not take into account the times that have a display: none.
var rtl = !1;
var _tg_postsslider = $("#tg-dbcategoriesslider");
_tg_postsslider.owlCarousel({
items: 2,
nav: true,
rtl: rtl,
loop: !1,
dots: true,
autoplay: !1,
navClass: ["tg-prev", "tg-next"],
navContainerClass: "tg-slidernav",
navText: ['<span class="icon-chevron-left"></span>', '<span class="icon-chevron-right"></span>'],
responsive: {0: {items: 2}, 640: {items: 3}, 768: {items: 4}},
info: function(info, element){
console.log(info);
}
});
$('.live-search-list .tg-category').each(function(){
$(this).attr('data-cat-name', $(this).text().toLowerCase().trim());
});
$(document).on('keyup','.live-search-box', function(){
var searchTerm = $(this).val().toLowerCase();
$('.live-search-list .tg-category').each(function(){
if ($(this).filter('[data-cat-name *= ' + searchTerm + ']').length > 0 || searchTerm.length < 1) {
$(this).parent().parent().show();
} else {
$(this).parent().parent().hide();
}
});
_tg_postsslider.trigger('refresh.owl.carousel');
});