this.appendChild(a) - 意外调用方法或属性访问
我在 IE8、IE7 和 IE6 上遇到运行时错误,它指出错误位于第 31852 行的 jQuery.min.js 中,
这是我编写的代码,所以我相信问题出在无限滚动插件上,因为它将项目附加到该文件。
经过进一步调试后,似乎有问题的行是这样的:
this.appendChild(a)
From jQuery.min.js, ie 根据调试器工具在该行上被阻塞。
var $container = $('.section');
function getInternetExplorerVersion()
{
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
var ver = getInternetExplorerVersion();
if ( ver > -1 )
{
$container.masonry({
itemSelector: '.section .article',
isFitWidth: true,
columnWidth: 270
});
} else {
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.section .article',
isFitWidth: true,
columnWidth: 270
});
});
}
$container.infinitescroll({
navSelector : '.footer .nav ul',
nextSelector : '.footer .nav ul li.next a',
itemSelector : '.section .article',
loadingImg : "images/loader.gif",
loadingText : 'Loading more wishes, please wait...',
donetext : "All Wishes have been loaded."
},
function( newElements ) {
var $newElems = $( newElements ).css({ opacity: 0 });
$newElems.imagesLoaded(function(){
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
);
I have a run time error on IE8 and IE7 and IE6 it is stating the error is in jQuery.min.js on line 31852
Here is the code i have written so i believe the issue is with the infinite scroll plugin as it appends items to the document.
After some further debugging it seems that the line in question is this:
this.appendChild(a)
From jQuery.min.js, ie is choking on this line according to the debugger tool.
var $container = $('.section');
function getInternetExplorerVersion()
{
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
var ver = getInternetExplorerVersion();
if ( ver > -1 )
{
$container.masonry({
itemSelector: '.section .article',
isFitWidth: true,
columnWidth: 270
});
} else {
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.section .article',
isFitWidth: true,
columnWidth: 270
});
});
}
$container.infinitescroll({
navSelector : '.footer .nav ul',
nextSelector : '.footer .nav ul li.next a',
itemSelector : '.section .article',
loadingImg : "images/loader.gif",
loadingText : 'Loading more wishes, please wait...',
donetext : "All Wishes have been loaded."
},
function( newElements ) {
var $newElems = $( newElements ).css({ opacity: 0 });
$newElems.imagesLoaded(function(){
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用 ulightbox 插件吗?
就我而言,我使用的是 ulightbox,因此,尝试删除一些插件。
Are you using ulightbox plugin?
In my case, I was using ulightbox, so, try deleting some plugins.