Isotope 'selected' class does not seem to work
-
20-12-2019 - |
Question
Has anybody had a problem with the 'selected' class in the Isotope jquery plugin.
I am trying to exclude certain divs from the list when the page first loads, however despite what 'data-option-value' has 'class=selected' Isotope still outputs all divs instead of just the ones I want.
Here is what I have:
<li><a href="#filter" data-option-value="*:not(.Blurb)" class="selected">Everything</a></li>
I know it's a long shot, but has anybody else had this problem, and if so how did you fix it?
Solution
Ok, so I found the answer. It was actually pretty simple. I just removed the 'Selected' class from the option li and gave it the id of 'first'. I then simply added:
$("#first").trigger("click");
To the end of the script to make the filter button fire.
Note: I had to give the li a new id and remove the selected class because the script has an if statement saying to ignore actions if the li already has the class of 'selected'.