Created
October 22, 2016 10:43
-
-
Save artygrand/a02a26f572cd26a0bfe3383c91f8e086 to your computer and use it in GitHub Desktop.
Isotope theme for module Sydes.Album
This file contains 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
<?php | |
$this->response->script[] = 'https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.1/isotope.pkgd.min.js'; | |
?> | |
<div id="filters" class="button-group"> | |
<button class="button is-checked" data-filter="*">Все</button> | |
<?php foreach ($result['tags'] as $tag){ ?> | |
<button class="button" data-filter=".<?=convertToAscii($tag);?>"><?=$tag;?></button> | |
<?php } ?> | |
</div> | |
<div class="grid"> | |
<?php foreach ($result['pictures'] as $item){ | |
$class = ""; | |
foreach ($item['tags'] as $tag) { | |
$class .= ' '.convertToAscii($tag); | |
} | |
?><a href="<?=$item['file'];?>" rel="lightbox[<?=$result['data']['id'];?>]" title="<?=$item['caption'];?>" class="grid-item<?=$class;?>"> | |
<img src="/cache/img/200_200_c<?=$item['file'];?>" alt="<?=$item['title'];?>"> | |
</a><?php } ?> | |
</div> | |
<script> | |
$(window).load(function(){ | |
var grid = $('.grid').isotope({ | |
itemSelector: '.grid-item', | |
layoutMode: 'fitRows' | |
}); | |
$('#filters').on( 'click', 'button', function() { | |
var filterValue = $(this).attr('data-filter'); | |
grid.isotope({ filter: filterValue }); | |
}); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment