而不是这个...
on_chunk_uploaded: function() {
$('#log').prepend("<span>Chunk finished uploading</span>")
}
你可以这样做......(如果你说的每个日志只显示 10 条消息?)
on_chunk_uploaded: function() {
$('#log').prepend("<span>Chunk finished uploading</span>")
// If there are now more than 10 log lines, remove the last one
if($('#log span').length > 10){
$('#log span:last').remove();
}
// Remove all classes from the log lines
$('#log span').removeClass();
var opacity = 100;
// Cycle through each line and add decrementing opacity classes
$.each($('#log span'), function(index, $element){
$element.addClass('opacity-' + opacity);
opacity = opacity - 10;
});
}
然后添加一些适当的 CSS,透明度从 opacity-100 到 opacity 0...(未经测试!)
CSS:
.opacity-100
{
/* Opaque, doesn't need transparency... */
}
.opacity-90
{
opacity: 0.9;
filter:Alpha(opacity=90);
}
.opacity-80
{
opacity: 0.8;
filter:Alpha(opacity=80);
}
/* All the way down to 0... */
注意:编辑代码,因为我不小心将不透明度附加到 . 而不是 +(PHP 习惯)