jQuery快速Live Filter角色问题

时间:2014-12-21 20:49:10

标签: javascript jquery filter

这里:http://jsfiddle.net/uo5ufobp/

当我使用大写字母“İ”进行过滤时,它正在工作。

it is working for upper case İ letter

但是当我使用小写字母时它不起作用

enter image description here

我的html页面

<div style="position:absolute">
<input id="search_input" placeholder="Sektör Ara"  class="filtrele_put" style=""  >
</div>
<ul id="search_list" class="pt-20">
<li style=""><a href="#">Alkollü İçecekler</a></li>
<li style=""><a href="#">Bahçe Ve Çocuk Firmaları</a></li>
<li style=""><a href="#">Çiçekciler</a></li>
<li style=""><a href="#">Yapay Çiçek</a></li>
<li style=""><a href="#">İç Dekorasyonr</a></li>
<li style=""><a href="#">İç Giyim</a></li>
<li style=""><a href="#">İç Giyim ve Çamaşır</a></li>
<li style=""><a href="#">İç Mimarlı</a></li>
<li style=""><a href="#">İçecek Sektörü</a></li>
<li style=""><a href="#">Yapay Çiçek/a></li>
</ul>

这是jQuery Fast Live Filter.js包含..

jQuery.fn.fastLiveFilter = function (list, options) {
    // Options: input, list, timeout, callback
    options = options || {};
    list = jQuery(list);
    var input = this;
    var lastFilter = '';
    var timeout = options.timeout || 0;
    var callback = options.callback || function () {};

    var keyTimeout;

    // NOTE: because we cache lis & len here, users would need to re-init the plugin
    // if they modify the list in the DOM later.  This doesn't give us that much speed
    // boost, so perhaps it's not worth putting it here.
    var lis = list.children();
    var len = lis.length;
    var oldDisplay = len > 0 ? lis[0].style.display : "block";
    callback(len); // do a one-time callback on initialization to make sure everything's in sync

    input.change(function () {
        // var startTime = new Date().getTime();
        var filter = input.val().toLowerCase();
        var li, innerText;
        var numShown = 0;
        for (var i = 0; i < len; i++) {
            li = lis[i];
            innerText = !options.selector ? (li.textContent || li.innerText || "") : $(li).find(options.selector).text();

            if (innerText.toLowerCase().indexOf(filter) >= 0) {
                if (li.style.display == "none") {
                    li.style.display = oldDisplay;
                }
                numShown++;
            } else {
                if (li.style.display != "none") {
                    li.style.display = "none";
                }
            }
        }
        callback(numShown);
        // var endTime = new Date().getTime();
        // console.log('Search for ' + filter + ' took: ' + (endTime - startTime) + ' (' + numShown + ' results)');
        return false;
    }).keydown(function () {
        clearTimeout(keyTimeout);
        keyTimeout = setTimeout(function () {
            if (input.val() === lastFilter) return;
            lastFilter = input.val();
            input.change();
        }, timeout);
    });
    return this; // maintain jQuery chainability
}

一些设置

 $(function() { $('#search_input').fastLiveFilter('#search_list');   });

我能为此做些什么呢?

这里:http://jsfiddle.net/uo5ufobp/

0 个答案:

没有答案