Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $container = $('.sort-container');
- createSortFunction = function(slug) {
- return function($elem) {
- var is_slug = $elem.hasClass(slug) ? ' ' : '';
- return (!is_slug?' ':'');
- };
- },
- getSortData = function(data) {
- var sortMethods = {};
- for (var index in data) {
- var slug = data[index].slug;
- sortMethods[slug] = createSortFunction(slug);
- }
- return sortMethods;
- }
- $.getJSON('member-cat-json.php', function (data) {
- $container.isotope({
- itemSelector: '.member-item',
- layoutMode: 'straightDown',
- sortAscending: true,
- getSortData: getSortData(data)
- });
- });
- var $optionSets = $('.option-set'),
- $optionLinks = $optionSets.find('a');
- $optionLinks.click(function(){
- var $this = $(this);
- // don't proceed if already selected
- if ( $this.hasClass('selected') ) {
- return false;
- }
- var $optionSet = $this.parents('.option-set');
- $optionSet.find('.selected').removeClass('selected');
- $this.addClass('selected');
- // make option object dynamically, i.e. { filter: '.my-filter-class' }
- var options = {},
- key = $optionSet.attr('data-option-key'),
- value = $this.attr('data-option-value');
- // parse 'false' as false boolean
- value = value === 'false' ? false : value;
- options[ key ] = value;
- // otherwise, apply new options
- $container.isotope( options );
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement