{namespace n=Ncn\NcnBase\ViewHelpers}

{reference.title}

{reference.subtitle}

$(function(){ function getHashFilter() { var hash = location.hash; // get filter=filterName var matches = location.hash.match( /([^&]+)/i ); var hashFilter = matches && matches[1]; return hashFilter && decodeURIComponent( hashFilter ); } $( function() { var $grid = $('.isotope'); // bind filter button click var $filters = $('.filter-nav').on( 'click', 'button', function() { var filterAttr = $( this ).attr('data-filter'); // set filter in hash location.hash = '/' + encodeURIComponent( filterAttr ); }); var isIsotopeInit = false; function onHashchange() { var hashFilter = getHashFilter(); if ( !hashFilter && isIsotopeInit ) { return; } isIsotopeInit = true; // filter isotope $grid.isotope({ itemSelector: '.grid-item', filter: hashFilter }); // set selected class on button if ( hashFilter ) { $filters.find('.active').removeClass('active'); $filters.find('[data-filter="#' + hashFilter + '"]').addClass('active'); } } $(window).on( 'hashchange', onHashchange ); // trigger event handler to init Isotope onHashchange(); }); })