jQuery анимация абсолютной позиции div не работает в IE 7 - PullRequest
1 голос
/ 19 сентября 2011

Следующий код вызывается 3 тегами в верхней части страницы. Страница представляет собой серию миниатюр, которые отфильтровываются нажатием на теги (http://parlaycreative.com/work). Эта функция прекрасно работает в SF и FF в Win и OSX, но не в IE. В IE при первом нажатии a код работает правильно, однако во второй раз, когда s уже исчезли, код не работает. Есть ли у IE проблема с выбором элементов с отображением: нет?


jQuery(document).ready(function() {
//Align objects in grid
    moveProjects('', 0);

// filter project previews on click
jQuery('.category-filter').mouseup(function() {
    var filter_string = '';

    // toggle .active state of fitler links
    if ( jQuery(this).is('.active')) {
        jQuery(this).removeClass('active');
    } 
    else {
        jQuery(this).addClass('active');
    }

    jQuery('.category-filter').each(function(index) {
        if(jQuery(this).is('.active')) {
            filter_string += '.' + jQuery(this).text().toLowerCase() + ',';
        }
    });

    // Remove trailing comma
    filter_string = filter_string.substring(0, filter_string.length-1);

    // Fade .project-preview-wrapper if inactive types
    jQuery('.project-preview-wrapper').not(filter_string).fadeOut('fast');

    setTimeout(moveProjects, 250, filter_string, 500);
});

// Set aboslute position of .project-preview-wrapper in grid
function moveProjects (filter_string, time) {
    var cur_item = 0;
    var num_cols = 4;
    var num_rows = 0;
    var preview_width = 150;
    var preview_height = 150;
    var margin = 9;

    jQuery('.project-preview-wrapper').each(function (index) {
        var left_val = margin * (cur_item % num_cols) + preview_width * (cur_item % num_cols);
        var top_val = num_rows * (preview_height + margin);
        if (jQuery(this).css('display') != 'none') {
            jQuery(this).animate({'left':left_val,'top':top_val}, time);
            if (cur_item % num_cols == 3) {
                num_rows ++;
            }
            cur_item++;
        }
        else if (jQuery(this).is(filter_string) || filter_string == '') {
            jQuery(this).animate({'left':left_val,'top':top_val}, 0).delay(time).fadeIn('fast');
            if (cur_item % num_cols == 3) {
                num_rows ++;
            }
            cur_item++;
        }
     });
    num_rows = Math.ceil(cur_item / num_cols);
    jQuery('.view-id-work').animate({'height':(num_rows) * (preview_height + margin)},time);
};  
});
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...