Показывать только 10 значений характеристик в фильтрах в теме Easysale
В файле category.filters.html нужно после кода <script> добавить следующий код:
$('.s-filter-wrapper').each(function () {
var limit = 10;
if ($(this).find('.s-filter-item').length > limit) {
$(this).find('.s-filter-item:gt(' + (limit - 1) + ')').hide();
var btn = $('<button type="button" class="btn btn-default btn-sm">Еще ' + ($(this).find('.s-filter-item').length - limit) + '</button>');
btn.on('click', function () {
if ($(this).data('expanded')) {
$(this).parent().find('.s-filter-item:gt(' + (limit - 1) + ')').hide();
$(this).html($(this).data('expanded'));
$(this).removeData('expanded');
} else {
$(this).parent().find('.s-filter-item:hidden').show();
$(this).data('expanded', $(this).html());
$(this).html('Свернуть');
}
return false;
});
$(this).append(btn);
}
});
Чтобы добавить комментарий, зарегистрируйтесь или войдите
0 комментариев