N
N
NDL2016-04-13 14:44:38
css
NDL, 2016-04-13 14:44:38

How to make Isotop js filter active?

Hello.
How to make one of the filters active in isotop js on page load?
When loading, it shows all elements and does not filter.

<p class="text-center" id="filter">
  <a href="" class="btn-service btn-serv current" data-filter=".1">1</a>
  <a href="" class="btn-service btn-serv"  data-filter=".2">2</a>
  <a href="" class="btn-service btn-serv" data-filter=".3">3</a>
</p>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-04-13
@thewind

The plugin itself will not filter anything natively (if you just initialize).
When initializing isotope, you need to find a link with the current class (if any) and take .data('filter') from there
And then initialize the isotope with the option {filter: '.1'}
But generally speaking, if your filter goes by the class name , then the error is STILL that classes cannot be named starting with numbers. So rename them to something like '.c1', '.c2' etc. And then it will turn out {filter: '.c1'}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question