1

我在 IE8 及以下版本中收到以下错误消息:预期对象。

它适用于所有其他浏览器。

该网站是http://www.gablabelle.com/

但我找不到问题所在。

var layoutI = 0;
var $container = $("#stream");
var $window = $(window);
function reLayout(){  
    var mediaQueryId = getComputedStyle( document.body, ':after' ).getPropertyValue('content');
    var mediaQueryId = mediaQueryId.replace( /"/g, '' );
    var windowSize = $window.width();
    var masonryOpts;
    switch ( mediaQueryId ) {
        case 'bigger' :
            masonryOpts = {
                columnWidth: 270,
                gutterWidth: 30
            };
        break;
        case 'big' :
            masonryOpts = {
                columnWidth: 220,
                gutterWidth: 20
            };
        break;
        case 'medium' :
            masonryOpts = {
                columnWidth: 166,
                gutterWidth: 20
            };
        break;
        case 'small' :
            masonryOpts = {
                columnWidth: $container.width() / 2,
                gutterWidth: 0
            };  
        break;
    };
    $container.isotope({
        resizable: false, // disable resizing by default, we'll trigger it manually
        itemSelector : "article.post",
        animationEngine: "best-available",
        masonry: masonryOpts,
        onLayout: function() {
        //  console.log('layout!' + (layoutI++) )
            forceLoad();
            setTimeout(function(){
                html_height = $container.height();
                $("#sidebar").height(html_height - masonryOpts.gutterWidth);
            }, 500);
        }
    });
};
$container.imagesLoaded( function(){
    reLayout();
    $window.smartresize( reLayout );
});

非常感谢您的帮助。

4

1 回答 1

2

错误开启getComputedStyle()。IE<8 不支持此功能

有关支持图表,请参见此处。

您可以使用这样的替代方法

于 2012-10-12T01:33:52.473 回答