2012-08-31 72 views
0

目前正在構建一個使用來自Desandro的jQuery Masonry的站點,其中內置了Infinite Scroll。除了IE之外,每個瀏覽器都能很好地工作(即使IE7和IE8也能正常工作)。看來,jQuery(函數)根本沒有執行。我已經通過放置警報進行測試,但從未執行。 IE Developer中沒有顯示錯誤。在IE9中不執行jQuery函數

這裏是我的代碼,並在網站的鏈接:http://www.elke.co/testimonials/

<script type="text/javascript"> 
    jQuery(function() { 
    var $container = jQuery('#sort'); 

    $container.imagesLoaded(function() { 

     $container.masonry({ 
     itemSelector: '.box', 
     columnWidth: 100 
     }); 
    }); 

    $container.infinitescroll({ 
     navSelector: '.navigation', // selector for the paged navigation 
     nextSelector: '.navigation .nav-previous a', // selector for the NEXT link (to page 2) 
     itemSelector: '.box', // selector for all items you'll retrieve 
     loading: { 
     finishedMsg: 'No more pages to load.', 
     img: 'http://www.elke.co/wp-content/themes/shaken-grid-free/images/ajax-loader.gif' 
     } 
    }, 
    // trigger Masonry as a callback 
    function (newElements) { 
     // hide new items while they are loading 
     var $newElems = jQuery(newElements).css({ 
     opacity: 0 
     }); 
     // ensure that images load before adding to masonry layout 
     $newElems.imagesLoaded(function() { 
     // show elems now they're ready 
     $newElems.animate({ 
      opacity: 1 
     }); 

     $container.masonry('appended', $newElems, true); 
     }); 
    }); 
    }); 
</script> 

回答

1

在Chrome中我看到:

Unsafe JavaScript attempt to access frame with URL http://www.elke.co/testimonials/ from frame with URL http://www.youtube.com/embed/g3V26BQ85IM. Domains, protocols and ports must match.

某種AJAX跨域的必須做的錯而IE的安全性就是拒絕這個請求,其他人則讓它滑落。

+0

我認爲你是正確的。它與IE9中的安全設置有關。 – plumwd