IE中的Isotope.js过滤器被破坏了

时间:2014-04-21 11:09:55

标签: javascript jquery jquery-isotope

我注意到,当IE尝试过滤我的应用程序时,isotope.js在IE中出现问题,结果看起来不合适(在我的情况下,它不在表格中)。我想知道这个是否有任何可用的解决方案?这是我的Fiddle和示例代码

var data = [{
    "RM_Name": "Russ Martin",
    "Division": "East",
    "RM_Phone": "(603) 491-1259",
    "RC_Name": "Jacob Sucoff",
    "RC_Phone": "(800) 247-4154 x3403",
    "States_Covered": "MT,VT, NH, ME  (all firms)",
    "Latitude": 46.6797995,
    "Longitude": -110.044783,
    "Coordinates": "46.6797995,-110.044783"
}, {
    "RM_Name": "Carey Fortnam",
    "Division": "East",
    "RM_Phone": "(585)-259-7394",
    "RC_Name": "Matt Wrzesniewsky",
    "RC_Phone": "(800) 247-4154 x3088",
    "States_Covered": "NY- Upstate ex Rockland County (BD, FP)",
    "Latitude": 40.7056308,
    "Longitude": -73.9780035,
    "Coordinates": "40.7056308,-73.9780035"

}];
        $.each(data, function(i, item) {
            var rm_name = item.RM_Name,division = item.Division,rm_phone = item.RM_Phone,rc_name = item.RC_Name,rc_phone = item.RC_Phone,states = item.States_Covered;

            var dataset='<tr class="'+rm_name+' '+rc_name+'"><td>'+rm_name+'</td><td>'+division+'</td><td>'+rm_phone+'</td><td>'+rc_name+'</td><td>'+rc_phone+'</td><td>'+states+'</td></tr>';

            $('.rm-data').append(dataset);
        });

    // init Isotope
    var $container = $('.rm-data');
    $('#search').on('keypress',function(e){
       if(e.which == 13){
           var query = $('#search').val();
           query = "tr:contains("+query+")";
           $container.isotope({ filter: query });
           console.log(query);

       }
    }); 

欢迎任何建议。谢谢。

1 个答案:

答案 0 :(得分:0)

我完全放弃了Isotope.js的想法,而是创建了自己的过滤功能。 Fiddle在这里。

我已经取代了这个:

// init Isotope
    var $container = $('.rm-data');
    $('#search').on('keypress',function(e){
       if(e.which == 13){
           var query = $('#search').val();
           query = "tr:contains("+query+")";
           $container.isotope({ filter: query });
           console.log(query);

       }
    });

有了这个:

$('#search').on('keypress',function(e){
        if(e.which=='13'){
        $('.rm-data tr').css('display','none');
        $('.error-msg').css('display','none');
        var query = $('#search').val();


        if($('.rm-data tr').hasClass(query)){
            $('.rm-data tr:contains('+query+')').fadeIn('slow',function(){
                $('.rm-data tr:contains('+query+')').css('display','block').slideDown();
            });


        }
        }

    });