【问题标题】:Isotope Filtering not working in Firefox同位素过滤在 Firefox 中不起作用
【发布时间】:2015-04-02 11:50:26
【问题描述】:

我正在尝试设置一个具有同位素过滤功能的页面。 这是我的代码:

      $(document).ready(function() {

            var $container = $('#isotope');

            $container.imagesLoaded(function() {
                // init

                $container.isotope({
                    // options
                    itemSelector : '.col-md-4',
                    layoutMode : 'masonry',

                    masonry : {
                        columnWidth : $container.find('.grid-sizer')[0],
                        gutter : 0
                    }

                });
            });

            $(function() {

                // filter functions

                // bind filter button click
                $('a.title').on('click', function() {

                    var filterValue = $(".col-md-4").attr('data-filter');
                    // use filterFn if matches value



                    $container.isotope({
                        filter : filterValue
                    });
                });

            });

        });

过滤在 Chrome 中运行良好。在 Firefox 中,只有砌体有效,过滤功能无效。我也尝试简单地按类过滤,这也不起作用。奇怪的是,Isotope Demo 在 Firefox 中运行良好...... 谢谢你的帮助。 M

【问题讨论】:

  • 您需要制作一个 jsfiddle 或至少发布您的 html。

标签: jquery firefox filter jquery-isotope


【解决方案1】:
$container.isotope({
  // filter element with numbers greater than 50
  filter: function() {
    // `this` is the item element. Get text of element's .number
    var number = $(this).find('.number').text();
    // return true to show, false to hide
    return parseInt( number, 10 ) > 50;
  }
})

See filtering with function here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-23
    • 2012-10-15
    • 2016-07-02
    • 2013-05-31
    • 2021-04-24
    • 1970-01-01
    相关资源
    最近更新 更多