Answer the question
In order to leave comments, you need to log in
How to switch modifiers by bam?
I'm trying to learn BEM. Wherever they talk about it, only the following is reported: "take a modifier and switch it."
How exactly to switch?
For example, in jquery there are methods
addClass, hasClass, removeClass и toggleClass
That is, if I want to recolor the button, then I will create a function like:
It all comes down to this, do I understand correctly?
$('.btn').addClass('btn-red');
Answer the question
In order to leave comments, you need to log in
BEM offers a methodology (approach, architecture) for dividing an interface into independent blocks.
If some blocks or elements have a special appearance or behavior (distinguishing them from similar blocks or elements ), then this is implemented using modifiers .
For example, a list with an "active" \ "highlighted" item:
<ul class="list">
<li class="list__item">item 1</li>
<li class="list__item">item 2</li>
<li class="list__item list__item_active">item 3</li>
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question