我正在创建一个网站,现在我用jQuery编程电梯。我的问题是,我已经创建了很多代码,并在导航中添加了一个脚本后,它可以工作,但点击照片后我得到了这个错误:
Uncaught Error: Syntax error, unrecognized expression: gallery/(3).jpg
这里是电梯的代码:
$(document).on('click', 'a, button', function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top
}, 500);
});
当我删除此代码时,错误不再显示。