目前正在构建一个使用Desandro的jQuery Masonry并内置无限滚动的网站。除IE之外的每个浏览器都能出色地工作(即使IE7和IE8也能正常工作)。似乎jQuery(函数)根本没有执行。我已通过在内部发出警报进行测试,但从未执行过。 IE Developer中没有显示错误。
以下是我的代码和指向该网站的链接: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>
答案 0 :(得分: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安全性只是拒绝请求,其他人则让它滑动。