Pergunta

I am using isotope to filter posts in wordpress based on their category. Everything is ok in Firefox, but in Safari and Chrome filtering is not working. When I click on a filter item, animation doesn't happen. Positioning is fine crossbrowser. Both Safari and Chrome are not reporting any errors in error console, so I have no idea what is wrong.

Here is the outputted html in Safari:

filter nav:

<div id="isotope-nav">
    <div class="gallery-fillter-wrapper">
        <select class="gallery-filter">
            <option>-- Filter galleries --</option>
            <option data-filter="*" class="isotope-nav-item">All galleries</option>                                                       <option data-filter=".art-exhibitions" class="isotope-nav-item">Art Exhibitions</option> 
                                                              <option data-filter=".historical-photos-exhibition" class="isotope-nav-item">Historical photos Exhibition</option> 
                                                              <option data-filter=".other-exhibitions" class="isotope-nav-item">Other exhibitions</option> 
                                                              <option data-filter=".springtime-in-the-royal-compound" class="isotope-nav-item">Springtime in The Royal Compound</option> 
                                                              <option data-filter=".summer-at-the-royal-compound" class="isotope-nav-item">Summer at The Royal Compound</option> 
                                                              <option data-filter=".the-artwork-of-the-month" class="isotope-nav-item">The Artwork of the Month</option> 
                                                                  <option data-filter=".the-regalia" class="isotope-nav-item">The Regalia</option> 
                                                              <option data-filter=".trh-prince-peter,-prince-philip-and-prince-alexander" class="isotope-nav-item">TRH Prince Peter, Prince Philip and Prince Alexander</option> 
                                                        </select>
    </div><!-- end .gallery-filter-wrapper -->
</div>

items that should be filtered

<div id="gallery-wrapper" style="position: relative; overflow: hidden; height: 1745px;" class="isotope">                                
    <div class="child-page-thumb art-exhibitions isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(0px, 0px, 0px);">
    </div><!-- end .child-page-thumb -->
    <div class="child-page-thumb art-exhibitions isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(239px, 0px, 0px);">
    </div><!-- end .child-page-thumb -->
    <div class="child-page-thumb art-exhibitions isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(478px, 0px, 0px);">
    </div><!-- end .child-page-thumb -->
    <div class="child-page-thumb historical-photos-exhibition isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(239px, 161px, 0px);">
    </div><!-- end .child-page-thumb -->
    <div class="child-page-thumb historical-photos-exhibition isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(478px, 161px, 0px);">
    </div><!-- end .child-page-thumb -->
    <div class="child-page-thumb historical-photos-exhibition isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(0px, 203px, 0px);">
    </div><!-- end .child-page-thumb -->
    <div class="child-page-thumb other-exhibitions isotope-item" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(239px, 343px, 0px);">
    </div><!-- end .child-page-thumb -->
</div>

and here is the javascript:

var cell_width = $('.child-page-thumb').outerWidth();
var cell_height = $('.child-page-thumb').outerHeight();
$container = $('#gallery-wrapper');

$container.isotope({
    layoutMode: 'masonry'
});

$('#isotope-nav option').click(function(){
    $selector = $(this).attr('data-filter');
    $container.isotope({filter: $selector});
    return false;
});
Foi útil?

Solução

I figured this one out. The problem was that in webkit browsers, selecting the <option> tag doesn't work as click, so I transformed the navigation to links, <a> tags, and everything works as it should cross-browser.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top