SyntaxError:缺少;before语句-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.');
}
}
请从函数中删除此"):"字符。
相关文章:
- SharePoint 2010 Jquery/JSON Rest Multiple OR语句-如何
- jquery if语句返回return wong语句
- jQuery模板中的If语句
- 将语句与jquery相结合,并使用媒体查询来实现返回页首按钮
- 使用条件语句,使 jquery fadeIn/fadeOut 仅在视口 >= 480px 时才有效
- MVC Jquery-按钮点击-获取if语句错误
- Jquery/Javascript使用IF/ELSE语句更改img SRC
- .has() 函数在 if 语句 (jQuery) 中不起作用
- 如何使用if语句jquery对数字进行动画处理
- SyntaxError:缺少;before语句-jQuery ContentHover
- Switch语句jQuery不适用于单选按钮值
- if 语句 (jQuery) 中的两个条件
- 在 if 语句 jquery 中使用此父级
- 语法错误: 缺少 ;在语句 Jquery 之前
- 如何触发if语句jQuery
- 将生成if-else语句jquery的脚本
- 多重选择值if语句jQuery
- 表的最后一个td与if语句- jquery
- 目标条件语句jQuery中提到的单个元素
- 正在生成if语句JQuery