jQuery Isotope Combination Filters mixed with BBQ Hash History - Need help understanding how to -



jQuery Isotope Combination Filters mixed with BBQ Hash History - Need help understanding how to -

i trying understand how utilize combination filters jquery bbq hash history.

what want have user filter logos, identity or branding. if user clicks logos, want them able subfilter "non-profit, education, retail" etc. know combination filters work fine without jquery bbq code implemented, both.

$optionsets.find('.filter-main a').click(function(){ var $this = $(this); // don't proceed if selected if ( $this.hasclass('selected') ) { return; } changeselectedlink( $this ); // href attr, remove leading # var href = $this.attr('href').replace( /^#/, '' ), // convert href object // i.e. 'filter=.inner-transition' -> { filter: '.inner-transition' } alternative = $.deparam( href, true ); // apply new alternative previous $.extend( isotopeoptions, alternative ); // set hash, triggers hashchange on window $.bbq.pushstate( isotopeoptions ); isoptionlinkclicked = true; homecoming false; });

see http://support.metafizzy.co/2011/isotope-combo-filters-hash-links.html

$(function(){ var $container = $('#container'), filters = {}, // filter hash, remove leading '#' filterselector = window.location.hash.slice(1); $('#filters a').click(function(){ // store filter value in object // i.e. filters.color = 'red' var $this = $(this), name = $this.attr('data-filter-name'), value = $this.attr('data-filter-value'), isofilters = [], filtername, prop; filters[ name ] = value; ( prop in filters ) { isofilters.push( filters[ prop ] ); } var filterselector = isofilters.join(''); // trigger isotope if ready if ( $container.data('isotope') ) { $container.isotope({ filter: filterselector }); } window.location.hash = filterselector; // toggle highlight $this.parents('ul').find('.selected').removeclass('selected'); $this.parent().addclass('selected'); homecoming false; }); // if there filter, trigger click on // corresponding alternative if ( filterselector ) { var selectorclasses = filterselector.split('.').slice(1); $.each( selectorclasses, function( i, selectorclass ) { $('#filters a[data-filter-value=".' + selectorclass + '"]').click(); }); } $('#container').isotope({ itemselector: '.item', filter: filterselector, masonry: { columnwidth: 80 } }); });

jquery jquery-isotope jquery-bbq

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -