Здравствуйте!
Есть скрипт который позволяет выбрать диапазон дней для расчета программы питания
var firstDay = 0;
var lastDay = 6;
$('.builder-days-selector a').on('click', function(event) {
var active = $('.builder-days-selector').find('.active').length;
if (active === 0) {
$(event.target.closest('a')).addClass('active');
firstDay = $(event.target.closest('a')).attr('data-slide-index');
} else if (active === 1) {
lastDay = firstDay;
$(event.target.closest('a')).attr('data-slide-index') > firstDay
? lastDay = $(event.target.closest('a')).attr('data-slide-index')
: firstDay = $(event.target.closest('a')).attr('data-slide-index');
for (var i = firstDay; i <= lastDay; i++) {
$("a[data-slide-index=" + i + "]").addClass('active');
}
} else {
$('.builder-days-selector a').removeClass('active');
$(event.target.closest('a')).addClass('active');
firstDay = $(event.target.closest('a')).attr('data-slide-index');
lastDay = firstDay;
}
});
<div class="custom-pager builder-days-selector">
<a class="active" data-slide-index="0"> <!-- class = "active"-->
<span class="pager-title">
Пн
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
<a class="active" data-slide-index="1">
<span class="pager-title">
Вт
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
<a class="active" data-slide-index="2">
<span class="pager-title">
Ср
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
<a class="active" data-slide-index="3">
<span class="pager-title">
Чт
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
<a class="active" data-slide-index="4">
<span class="pager-title">
Пт
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
<a class="active" data-slide-index="5">
<span class="pager-title">
Сб
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
<a class="active" data-slide-index="6">
<span class="pager-title">
Вс
</span>
<span class="circle">
<span class="inner-circle"></span>
</span>
</a>
</div>
Как его переделать чтоб можно было выбирать только конкретные дни?
Спасибо!