简体   繁体   中英

jquery Uncaught SyntaxError: Unexpected token -

I've looked around through the jQuery docs and google and I can't seem to figure this out, though I have a feeling it's probably something really obvious I'm missing. For some reason, I get this error,

Uncaught SyntaxError: Unexpected token -

,everytime I try and execute my script and I have no idea why (I've tried the script with and without the two - negative signs but it doesn't make a difference).

Here's my code:

$('.head').hover(function() {
    $(this).stop().animate({text-indent:'-60px'},100);
}, function() {
    $(this).stop().animate({text-indent:'-50px'},200);
});

Try:

$('.head').hover(function() {
    $(this).stop().animate({'text-indent':'-60px'},100);
}, function() {
    $(this).stop().animate({'text-indent':'-50px'},200);
});

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM