(☞ຈل͜ຈ)☞ Главная  Статьи  Загрузчик Домой

Ok!
Ok!
174
function find_closed() {
    //clearTimeout(typingTimer);
    //typingTimer = setTimeout(doneTyping, doneTypingInterval);
    var found;
    var tr = jQuery('.pricing tr');
    var pos = jQuery('body, html').scrollTop();
    var s = jQuery('#searchfield').val();
    //var add = jQuery('.prices').first().position().top;
    var old, i, cont;
    if(s.length > 2) {
        old = jQuery('.found_color').parents('td');
        jQuery.each(old, function(){
            cont = jQuery(this).text();
            old.text(cont);
        });
        jQuery('tr').removeClass('found');
        for (i = 0; i < tr.length; i++) {

            if (tr.eq(i).text().toLowerCase().indexOf(s.toLowerCase()) > -1) {
                tr.eq(i).addClass('opened found');
                var text = tr.eq(i).children('td:first-child').text().replace(s, '<span class=found_color>' + s + '</span>');
                //console.log(text);
                tr.eq(i).children('td:first-child').html(text);
                found = 1;
            }else{
                //tr.eq(i).remove();
                tr.eq(i).removeClass('opened');
                tr.eq(i).removeClass('found');
            }

        }
        if(jQuery('.found').length){
            var E = setTimeout(function(){
                pos += jQuery('.found').first().parents('table').position().top;
                jQuery('body, html').animate({scrollTop: pos}, 300, 'swing');
                console.log(pos);
            },300);
        }
        if (found < 1) {
            jQuery('.not-found').text('Не найдено на этой странице. Поищите через общий поиск')
        }
    }
}
найти в скрытом аккордионе12300find_closed с подстветкой
1 2 3 4 5 6 7 8 9 10 11 12 13 14