作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我找到了这个答案:
How can I change text after time using jQuery?
这基本上满足了我的需要。但我不想让它在最后重定向到另一个页面,而是希望它继续无限地循环浏览短信。显然,我删除了 IF 部分以停止重定向,但如何让它重复循环短信?
function nextMsg() {
if (messages.length == 0) {
// once there is no more message, do whatever you want
alert("redirecting");
} else {
// change content of message, fade in, wait, fade out and
// continue with next message
$('#message').html(messages.pop()).fadeIn(500).delay(1000)
.fadeOut(500, nextMsg);
}
};
// list of messages to display var messages = [
// "Hello!",
// "This is a website!",
// "You are now going to be redirected.",
// "Are you ready?",
// "You're now being redirected..."
// ].reverse();
// initially hide the message $('#message').hide();
// start animation nextMsg();
最佳答案
只需对基本代码进行一些小的更改:
function nextMsg(i) {
if (messages.length == i) {
i = 0;
}
$('#message').html(messages[i])
.fadeIn(500)
.delay(1000)
.fadeOut(500, function() {
nextMsg(i + 1);
});
};
nextMsg(0);
关于jquery - 使用 jQuery 在设定时间后更改文本颜色,并无限重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12572305/
我想成为 Spark 纱客户(link)。是否需要安装hadoop?还是只安装 yarn 可以吗? (by this link) 最佳答案 No Spark不需要Hadoop即可运行。 Apache
我是一名优秀的程序员,十分优秀!