Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display a maximum of n filtr-items #44

Closed
uqcgreen opened this issue Feb 18, 2017 · 3 comments
Closed

How to display a maximum of n filtr-items #44

uqcgreen opened this issue Feb 18, 2017 · 3 comments

Comments

@uqcgreen
Copy link

Hi there,

I only ever want to display for instance 6 filtr-items.

What is the best way to go about that? The only thing I could come up with is try to hide them in one of the callbacks.

Regards,

Cameron

@uqcgreen
Copy link
Author

uqcgreen commented Feb 20, 2017

For future reference, in set options this seemed to work.

 callbacks: {
            'onFilteringEnd': function () {
              $('div.filtr-container div.filtr-item').filter(function() {
                return $(this).css('opacity') !== '0';
              }).each(function(index) {
                if (index >= max_elements) {
                  $(this).css('opacity', '0');
                }
              });
            }
          }

@giotiskl
Copy link
Owner

@bcccgreen looks like a fine solution, thanks for sharing

@uqcgreen
Copy link
Author

uqcgreen commented May 19, 2017

@giotiskl Actually in the end I did this with a pull request. Seems to work well.

#49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants