Uncaught TypeError: Cannot read property ‘top’ of undefined
因为选择器没有找到对应的dom,所以offset()方法返回null,再.top就报错了,先判断有没有dom元素
if($(".captchaText")){}
$(‘body,html’).animate({scrollTop: $(".captchaText").next().offset().top - 100},1000);
return;
}
Uncaught TypeError: Cannot read property ‘top’ of undefined
因为选择器没有找到对应的dom,所以offset()方法返回null,再.top就报错了,先判断有没有dom元素
if($(".captchaText")){}
$(‘body,html’).animate({scrollTop: $(".captchaText").next().offset().top - 100},1000);
return;
}