Javascript 添加文本时淡入淡出div背景 函数showText(文本){ $(“#消息”)。追加(text+””; $(“#消息”).scrollTop($(“#消息”)[0]。scrollHeight); //上面的一行是自动滚动div到最后添加的文本 }
我希望添加线条的背景先淡入,然后淡出(它应该在半秒钟后淡出,或者类似的东西,只是为了引起用户的注意)。 我不知道如何使用css。如果可能的话,淡入淡出的颜色应该是像灯泡一样的黄色,就像它被高亮显示一样:PJavascript 添加文本时淡入淡出div背景 函数showText(文本){ $(“#消息”)。追加(text+””; $(“#消息”).scrollTop($(“#消息”)[0]。scrollHeight); //上面的一行是自动滚动div到最后添加的文本 },javascript,jquery,html,fadein,fadeout,Javascript,Jquery,Html,Fadein,Fadeout,我希望添加线条的背景先淡入,然后淡出(它应该在半秒钟后淡出,或者类似的东西,只是为了引起用户的注意)。 我不知道如何使用css。如果可能的话,淡入淡出的颜色应该是像灯泡一样的黄色,就像它被高亮显示一样:P 提前感谢:)我找到了您想要的东西: 然后将其反转,使其淡出。谢谢@Stephen!:我要是以前见过这个就好了。。。除息的 function showText(text) { $("#messages").append(text + "</br>"); $("#me
提前感谢:)我找到了您想要的东西:
然后将其反转,使其淡出。谢谢@Stephen!:我要是以前见过这个就好了。。。除息的
function showText(text) {
$("#messages").append(text + "</br>");
$("#messages").scrollTop($("#messages")[0].scrollHeight);
//line above is to automatically scroll the div to last added text
}
$.fn.bgColorFade = function(userOptions) {
// starting color, ending color, duration in ms
var options = $.extend({
start: "yellow",
end: "#fff",
time: 500
}, userOptions || {});
$(this).css({
backgroundColor: options.start
}).animate({
backgroundColor: options.end
}, options.time);
return this;
};
$(".test").bgColorFade({
time: 500
});