答案 0 :(得分:7)
function fx(o) {
var $o = $(o);
$o.html($o.text().replace(/([\S])/g, "<span>$1</span>"));
$o.css("position", "relative");
$("span", $o).each(function(i) {
var newTop = Math.floor(Math.random()*500)*((i%2)?1:-1);
var newLeft = Math.floor(Math.random()*500)*((i%2)?1:-1);
$(this).css({position: "relative",
opacity: 1,
fontSize: 12,
top: 0,
left: 0
}).animate({
opacity: 0,
fontSize: 84,
top: newTop,
left:newLeft
},1000);
});
}
查看代码