SyntaxError: missing ; before statement - jQuery ContentHover

SyntaxError: missing ; before statement - jQuery ContentHover

控制台报错,说这段代码有问题..

$.fn.contenthover = function(method) {  
    if (methods[method]) {
        return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
    } else if (typeof method === 'object' || !method) {
        return methods.init.apply(this, arguments);
    } else {
        $.error('Method '+ method +' does not exist in contentHover plugin.');
    }
});

还有 HTML

中的这个
<script>
$(document).ready(function(){
    $('#d1').contenthover({
        overlay_background:'#000',
        overlay_opacity:0.5
    });
});
</script>

有人能告诉我我哪里做错了吗?谢谢! - 仍在学习

     $.fn.contenthover = function(method) {  
if (methods[method]) {
    return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
    return methods.init.apply(this, arguments);
} else {
    $.error('Method '+ method +' does not exist in contentHover plugin.');
} 
}         

请从函数中删除 "):" 个字符。

在我看来,这个问题的结尾就像一个尾随的括号。试试这个:

$.fn.contenthover = function(method) {  
    if (methods[method]) {
        return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
    } else if (typeof method === 'object' || !method) {
        return methods.init.apply(this, arguments);
    } else {
        $.error('Method '+ method +' does not exist in contentHover plugin.');
    }
};