我在Google Chrome中遇到Uncaught SyntaxError: Unexpected token :
错误。我知道这意味着,但我不明白如何解决这个错误。
$(function(){
$('.hunbun').readmore(function(){
speed: 1000,
collapsedHeight: 200, // < here get the that error
moreLink: '<a href="#">read more</a>',
lessLink: '<a href="#">close</a>'
});
});
答案 0 :(得分:0)
是的,你有语法错误:.readmore
调用需要对象参数传递函数引用,在函数体中你写下你应该写的对象:
$(function(){
$('.hunbun').readmore({
speed: 1000,
collapsedHeight: 200, // < here get the that error
moreLink: '<a href="#">read more</a>',
lessLink: '<a href="#">close</a>'
});
});
从第二行删除function()