jQuery - 悬停时动画

wha*_*ide 0 javascript jquery jquery-animate

我知道这可能会被重复关闭,但在所有类似问题中我仍无法找到问题的答案.

我希望animate()在鼠标悬停时我的页面上的元素(通过jQuery,你已经猜到了).我做的是:

$('blockquote').hover(function() {
    console.log($(this));
    $(this).animate({textSize: '+=10px'}, 500);
}, function() {
    $(this).animate({textSize: '-=10px'}, 500);
});
Run Code Online (Sandbox Code Playgroud)

console.log日志如下:

[blockquote#daily_quote, context: blockquote#daily_quote, jquery: "1.9.1", constructor: function, init: function, selector: ""…]
Run Code Online (Sandbox Code Playgroud)

内部的两个函数都hover被调用,$(this)被记录但没有任何动画.

und*_*ned 5

用途fontSize:

$('blockquote').hover(function() {
    // console.log($(this));
    $(this).animate({fontSize: '+=10px'}, 500);
}, function() {
    $(this).animate({fontSize: '-=10px'}, 500);
});
Run Code Online (Sandbox Code Playgroud)