<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html><html class=''>
<head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/malles/pen/xweBge?limit=all&page=2&q=uikit" />
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/uikit/2.23.0/css/uikit.almost-flat.min.css'>
<style class="cp-pen-styles"></style></head><body>
<div class="uk-container uk-container-center">
<h1 class="uk-margin-top">Dynamic grid multifilter</h1>
<!-- Filter Controls -->
<ul class="grid-filter uk-subnav uk-subnav-pill">
<li data-uk-filter="" class="uk-active"><a href="">All</a></li>
<li data-uk-filter="box"><a href="">Box</a></li>
<li data-uk-filter="box-primary"><a href="">Box primary</a></li>
<li data-uk-filter="box-secondary"><a href="">Box secondary</a></li>
</ul>
<ul class="grid-filter uk-subnav uk-subnav-pill">
<li data-uk-filter="" class="uk-active"><a href="">All</a></li>
<li data-uk-filter="badge"><a href="">Badge</a></li>
<li data-uk-filter="badge-warning"><a href="">Badge warning</a></li>
<li data-uk-filter="badge-danger"><a href="">Badge danger</a></li>
</ul>
<ul class="grid-filter uk-subnav uk-subnav-pill">
<li data-uk-filter="" class="uk-active"><a href="">All</a></li>
<li data-uk-filter="button"><a href="">Button</a></li>
<li data-uk-filter="button-primary"><a href="">Button primary</a></li>
<li data-uk-filter="button-success"><a href="">Button success</a></li>
</ul>
<!-- Dynamic Grid -->
<div id="grid" class="uk-grid uk-grid-small uk-grid-width-1-3">
<div data-uk-filter="box,badge,button">
<div class="uk-panel uk-panel-box">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box</p>
<button class="uk-button">Button</button>
</div>
</div>
<div data-uk-filter="box-primary,badge-warning,button-primary">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<div class="uk-panel-badge uk-badge uk-badge-warning">Badge warning</div>
<p>Box primary</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
<div data-uk-filter="box-secondary,badge-danger,button-success">
<div class="uk-panel uk-panel-box uk-panel-box-secondary">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box secondary</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box,badge-warning,button">
<div class="uk-panel uk-panel-box">
<div class="uk-panel-badge uk-badge uk-badge-warning">Badge warning</div>
<p>Box</p>
<button class="uk-button">Button</button>
</div>
</div>
<div data-uk-filter="box,badge,button-success">
<div class="uk-panel uk-panel-box">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box,badge-danger,button-success">
<div class="uk-panel uk-panel-box">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box,badge-danger,button-primary">
<div class="uk-panel uk-panel-box">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
<div data-uk-filter="box,badge,button-primary">
<div class="uk-panel uk-panel-box">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
<div data-uk-filter="box-primary,badge-warning,button">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<div class="uk-panel-badge uk-badge uk-badge-warning">Badge warning</div>
<p>Box primary</p>
<button class="uk-button">Button</button>
</div>
</div>
<div data-uk-filter="box-primary,badge,button-success">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box primary</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box-primary,badge-danger,button-success">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box primary</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box-primary,badge-danger,button-primary">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box primary</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
<div data-uk-filter="box-primary,badge,button-primary">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box primary</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
<div data-uk-filter="box-secondary,badge-warning,button">
<div class="uk-panel uk-panel-box uk-panel-box-secondary">
<div class="uk-panel-badge uk-badge uk-badge-warning">Badge warning</div>
<p>Box</p>
<button class="uk-button">Button</button>
</div>
</div>
<div data-uk-filter="box-secondary,badge,button-success">
<div class="uk-panel uk-panel-box uk-panel-box-secondary">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box-secondary,badge-danger,button-success">
<div class="uk-panel uk-panel-box uk-panel-box-secondary">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box</p>
<button class="uk-button uk-button-success">Button success</button>
</div>
</div>
<div data-uk-filter="box-secondary,badge-danger,button-primary">
<div class="uk-panel uk-panel-box uk-panel-box-secondary">
<div class="uk-panel-badge uk-badge uk-badge-danger">Badge danger</div>
<p>Box</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
<div data-uk-filter="box-secondary,badge,button-primary">
<div class="uk-panel uk-panel-box uk-panel-box-secondary">
<div class="uk-panel-badge uk-badge">Badge</div>
<p>Box</p>
<button class="uk-button uk-button-primary">Button primary</button>
</div>
</div>
</div>
</div>
<script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script><script src='https://getuikit.com/dist/js/uikit.js'></script><script src='https://getuikit.com/dist/js/components/grid.js'></script>
<script >(function($, UI) {
var controls, grid, filters;
function filterGrid() {
filters = [];
controls.filter('.uk-active').each(function() {
var filter = $(this).data('ukFilter');
if (filter !== '') filters.push(filter)
});
grid.filter(filters.join(','));
}
UI.ready(function() {
controls = $('[data-uk-filter]');
grid = UI.grid('#grid', {gutter: 20});
controls.on('click', function(e) {
e.preventDefault();
$(this).addClass('uk-active').siblings().removeClass('uk-active')
filterGrid();
});
filterGrid();
//just to show the UIkit version in this pen
UI.$body.prepend('<div class="uk-float-right uk-badge">UIkit version: ' + UIkit.version + '</div>');
});
}(UIkit.$, UIkit));
//# sourceURL=pen.js
</script>
</body></html>