Created
April 5, 2019 20:54
-
-
Save badabingbreda/0098a652ae1cbf0929c58e3a228961b7 to your computer and use it in GitHub Desktop.
Toolbox Example: Dynamic Group Filter JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery( '.chooser' ).on( 'click' , function( event ) { | |
var $this = jQuery(this); | |
var term = $this.data('term'); | |
if ( $this.hasClass( 'uk-button-primary' ) ) { | |
var $unterm = jQuery( '.shadow[data-term="' + term + '"]' ); | |
UIkit.filter('[uk-filter="target: .js-filter"]', { target: ".js-filter" } ).apply( $unterm ); | |
} else { | |
UIkit.filter('[uk-filter="target: .js-filter"]', { target: ".js-filter" } ).apply( $this ); | |
} | |
$this.toggleClass('uk-button-primary'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment