Javascript错误-未捕获类型错误:无法读取属性';顶部';未定义的
我有一个错误: 未捕获的TypeError:无法读取未定义的属性“top” 在这条线上Javascript错误-未捕获类型错误:无法读取属性';顶部';未定义的,javascript,jquery,Javascript,Jquery,我有一个错误: 未捕获的TypeError:无法读取未定义的属性“top” 在这条线上 $('html, body').animate({ scrollTop: $('.lightbox-wrap').offset().top - 80 }, 800); 完整的代码是 $('.lightbox-wrap').hover(function(){ clearTimeout(timeout); }, function(){ timeout = setTime
$('html, body').animate({ scrollTop: $('.lightbox-wrap').offset().top - 80 }, 800);
完整的代码是
$('.lightbox-wrap').hover(function(){
clearTimeout(timeout);
}, function(){
timeout = setTimeout("$('#close_subscribe_lightbox').click();", 5000);
});
*/
setTimeout("$('.overlay').show();", 5000);
setTimeout("$('.lightbox-wrap').show();", 5000);
setTimeout("$('html,body').animate({ scrollTop: $('.lightbox-wrap').offset().top - 80 }, 800);", 5000);
// to set time out in lightbox
//setTimeout("$('#close_subscribe_lightbox').click();", 5000);
您的代码表明您的.lightbox包装已隐藏。 请注意,.offset()属性将不适用于使用
display:none
隐藏的对象:
在解释函数之前,您需要确保对象是“可见的”。您可以发布html吗?另外,为什么看起来您要用
*/
关闭块注释?您的代码将无法在其当前状态下运行。请发布完整的工作(即语法无错误)代码,以便更容易找出错误。