Answer the question
In order to leave comments, you need to log in
How to remove elements following the selected element?
I make breadcrumbs, when moving, say, to the middle of the chain, it is necessary that the elements in front are removed from the array, only the active element and what was in front of it remain.
Main->Product Category->Product1->Subcategory->Product2
When clicking on Product1, only the chain
Main->Product Category->Product1 remains.
Now it is implemented so that when switching to a product, the product name is transferred to the breadcrumbs array using the push method.
I understand that something like this is needed:
var count = this.breadcrumbs.length;
this.breadcrumbs.pop(product, count);
On the selected element, the presence of class="active" is implemented, if anything.
Many thanks in advance for your help.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question