Isotope add dynamically getSortData

admin

Administrator
Staff member
I'm trying to use isotope.js on my wordpress theme. <br>
I would sort the object in this way, where "Series,Music,Cultura,Sport" are "filter" generated by the custom taxonomy.

Code:
var $container = $j('.containerport');
                    $container.isotope({
                        stamp: '.stamp',
                        itemSelector: '.thumbportfolio',
                        getSortData : {
                            Series : function( $elem ) {
                                var isSeries = $j($elem).hasClass('Series');
                                return (!isSeries?' ':'');
                            },
                            Musica : function( $elem ) {
                                var isMusica = $j($elem).hasClass('Musica');
                                return (!isMusica?' ':'');
                            },
                            Cultura : function( $elem ) {
                                var isCultura = $j($elem).hasClass('Cultura');
                                return (!isCultura?' ':'');
                            },
                            Sport : function( $elem ) {
                                var isSport = $j($elem).hasClass('Sport');
                                return (!isSport?' ':'');
                            }
                        }
                    });

I would create a dynamic getSortData because if I add a new filter it should appear automatically without put hands inside the code. <br>
Is it possibile?<br> Maybe with an array or a for cycle, but I don't know how to access to the list of the filter through jquery.
Thanks!