In the following code i have error Uncaught SyntaxError: Unexpected token ;
in line 98 (this line has been determined in code), I want put codes in a function (like: tooltip()
) but get error, how is fix it?
My code that have error:
function tool_tip() {
$('.tooltip_hover').hover(function () {
var $tooltip = $(this).prev();
//var $tooltip = $('.tooltip');
var offset = $(this).offset();
var delay = setTimeout(function () {
$tooltip.fadeIn();
var width = $tooltip.outerWidth();
var p_top = offset.top;
var tt_ht = $tooltip.height();
p_top = (p_top + tt_ht > $(window).height()) ? p_top - tt_ht : p_top;
var p_left = offset.right - width;
$tooltip.css({
top: p_top,
right: p_left
}).fadeIn(180);
}, 280);
$(this).data('delay', delay);
$(this).data('tooltip', $tooltip);
}, function () {
delay = $(this).data('delay');
$tooltip = $(this).data('tooltip');
$('.tooltip').hide();
clearInterval(delay);
});
}); // this is line 98
}); // this is line 98
should be:
} // this is line 98
because tool_tip
is a function, or match with an opening parenthesis:
(function tool_tip () {
// stuff
});
看起来你有一个额外的)在最后。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.