|
@@ -101,21 +101,24 @@
|
|
|
* Filter projects.
|
|
|
* --------------------------------------------------------------------------- */
|
|
|
|
|
|
- let $grid_projects = $('#container-projects');
|
|
|
- $grid_projects.imagesLoaded(function () {
|
|
|
- // Initialize Isotope after all images have loaded.
|
|
|
- $grid_projects.isotope({
|
|
|
- itemSelector: '.isotope-item',
|
|
|
- layoutMode: 'masonry',
|
|
|
- filter: $('#default-project-filter').text()
|
|
|
- });
|
|
|
-
|
|
|
- // Filter items when filter link is clicked.
|
|
|
- $('#filters a').click(function () {
|
|
|
- let selector = $(this).attr('data-filter');
|
|
|
- $grid_projects.isotope({filter: selector});
|
|
|
- $(this).removeClass('active').addClass('active').siblings().removeClass('active all');
|
|
|
- return false;
|
|
|
+ $('.projects-container').each(function(index, container) {
|
|
|
+ let $container = $(container);
|
|
|
+ let $section = $container.closest('section');
|
|
|
+
|
|
|
+ $container.imagesLoaded(function() {
|
|
|
+ // Initialize Isotope after all images have loaded.
|
|
|
+ $container.isotope({
|
|
|
+ itemSelector: '.isotope-item',
|
|
|
+ layoutMode: 'masonry',
|
|
|
+ filter: $section.find('.default-project-filter').text()
|
|
|
+ });
|
|
|
+ // Filter items when filter link is clicked.
|
|
|
+ $section.find('.project-filters a').click(function() {
|
|
|
+ let selector = $(this).attr('data-filter');
|
|
|
+ $container.isotope({filter: selector});
|
|
|
+ $(this).removeClass('active').addClass('active').siblings().removeClass('active all');
|
|
|
+ return false;
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|