1

我是 jQuery 的新手。我想<h1>改变我网站中字体的外观,但它应该慢慢地从白色变为黑色。

这是一个例子:

http://www.worklifebalancecentre.org/

这是我尝试过的源代码:

$(document).ready(function() {
  $("div").animate({left:'200'}, "slow");
  $(h1).animate({color:'black'}, "slow");
});

但它不起作用......:/

4

2 回答 2

4
$(document).ready(function(){
 $('button').click(function(){  
 $('h1').stop().animate({ color: 'red' }, 1000);
 });
});

点击这个小提琴链接,http://jsfiddle.net/parsanamoni/pJefM/。我希望这对你的问题是正确的。

于 2013-06-25T04:42:17.970 回答
0

使用 jQuery UI: http: //jsfiddle.net/qZjHs/(或 jQuery + 颜色插件)

$div.animate({ color: 'lime' }, 2000);

使用 CSS:http: //jsfiddle.net/m47xL/1/

$div.addClass('lime');
于 2013-06-24T12:36:26.460 回答