Plugin Directory

Changeset 2053059


Ignore:
Timestamp:
03/19/2019 03:31:14 AM (7 years ago)
Author:
db0112358
Message:

fix isotope selected class

Location:
content-repeater/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content-repeater/trunk/readme.txt

    r2053055 r2053059  
    8484field inserter improvements
    8585= 1.0.6 =
    86 fixed post sorting issue
     86fix post sorting issue
     87fix isotope selected class
  • content-repeater/trunk/repeaters/isotope/isotope.php

    r2045559 r2053059  
    149149<script type='text/javascript'>
    150150(function($){   
    151 // $(window).load(function() {
    152 $(document).ready(function(){   
    153 $('.filters-button-group').on( 'click', 'a', function(e) {
    154     e.preventDefault();
    155     var filterValue = '.'+$(this).attr('class').split(' ')[0];
    156     if(filterValue.length == 1 || filterValue == '.all') filterValue = '*';
    157     parent = $(this).parents('.<?php echo self::$b; ?>-wrap');
    158     parent.find('.grid').isotope({ filter: filterValue });
    159 });
    160 // change is-checked class on buttons
    161 $('.button-group').each( function( i, buttonGroup ) {
    162     var $buttonGroup = $(buttonGroup);
    163     $buttonGroup.on( 'click', 'a', function(e) {
    164         e.preventDefault();
    165         document.location.hash = $(this).attr('class').split(' ')[0];
    166         $buttonGroup.find('.is-checked').removeClass('is-checked');
    167         $(this).addClass('is-checked');
     151    // $(window).load(function() {
     152    $(document).ready(function(){   
     153        $('.filters-button-group').on( 'click', 'a', function(e) {
     154            e.preventDefault();
     155            var filterValue = '.'+$(this).attr('class').split(' ')[0];
     156            if(filterValue.length == 1 || filterValue == '.all') filterValue = '*';
     157            parent = $(this).parents('.<?php echo self::$b; ?>-wrap');
     158            parent.find('.grid').isotope({ filter: filterValue });
     159        });
     160        // change is-checked class on buttons
     161        $('.button-group').each( function( i, buttonGroup ) {
     162            var $buttonGroup = $(buttonGroup);
     163            $buttonGroup.on( 'click', 'a', function(e) {
     164                e.preventDefault();
     165                document.location.hash = $(this).attr('class').split(' ')[0];
     166                $buttonGroup.find('.is-checked').removeClass('is-checked');
     167                $(this).addClass('is-checked');
     168            });
     169        });
     170
     171        setTimeout(function() {
     172            var filterValue = '.'+window.location.hash.substring(1);
     173            if(filterValue.length == 1 || filterValue=='.all') filterValue = '*';
     174            var g = $('.<?php echo $type; ?>-<?php echo self::$b; ?>');
     175            g.isotope({
     176                filter: filterValue,
     177                itemSelector: '.grid-item',
     178                masonry: {
     179                    columnWidth: '.grid-sizer',
     180                    gutter: <?php echo $padding; ?>,
     181                    fitWidth: true,
     182                }
     183            });
     184            if(filterValue != '*') g.closest('.<?php echo self::$b; ?>-wrap').find(filterValue).addClass('is-checked');
     185            g.imagesLoaded().progress( function() { // reposition layout on imagesLoaded
     186                g.isotope('layout');
     187            });
     188            $('.<?php echo self::$b; ?>-wrap').css('visibility','visible');
     189        }, 200);
    168190    });
    169 });
    170 
    171 setTimeout(function() {
    172     var filterValue = '.'+window.location.hash.substring(1);
    173     if(filterValue.length == 1 || filterValue=='.all') filterValue = '*';
    174     var g = $('.<?php echo $type; ?>-<?php echo self::$b; ?>');
    175     g.isotope({
    176         filter: filterValue,
    177         itemSelector: '.grid-item',
    178         masonry: {
    179             columnWidth: '.grid-sizer',
    180             gutter: <?php echo $padding; ?>,
    181             fitWidth: true,
    182         }
    183     });
    184     g.imagesLoaded().progress( function() { // reposition layout on imagesLoaded
    185         g.isotope('layout');
    186     });
    187     $('.<?php echo self::$b; ?>-wrap').css('visibility','visible');
    188 }, 200);
    189 });
    190191})(jQuery);
    191192</script>
Note: See TracChangeset for help on using the changeset viewer.