我想在显示跨度时添加此功能。并且在显示div时也开始。目前它工作正常但它会在页面加载后立即启动。我尝试在onclick('nextMSG();')等上尝试了很多不同的选项,与$(docment)相同.onload(function){etc
function nextMsg() {
if (messages.length == 0) {
} else {
$('#message').html(messages.pop()).fadeIn(500).delay(20000).fadeOut(500, nextMsg);
return true;
}
};
var messages = [
"Downloading Video ...",
"Converting video into a web friendly format ...",
"Combining Video and Layout ...",
"Preparing email for client ...",
"Sending email ...",
"Email sent!"
].reverse();
$('#message').hide();
nextMsg();
});
目前,我的onclick无法使用。其他一切都有效。它显示了我的图像等很棒。但是我想添加上面的消息,所以看起来它正在做一些其他的东西..更像是一个视觉。
<input type="image" name="submit" src="generate-button.gif" class="submit" value="Generate Mock-up" onclick="confirm('Are you sure everything is correct?');return loadSubmit();return nextMsg();"></center>
我让它看起来像正在下载视频,转换等等。
思想?
答案 0 :(得分:1)
首先要清理一下这个想法:
var messages = [
"Downloading Video ...",
"Converting video into a web friendly format ...",
"Combining Video and Layout ...",
"Preparing email for client ...",
"Sending email ...",
"Email sent!"
].reverse();
function nextMsg(){
if(messages.length >0){
$('#message').html(messages.pop()).fadeIn(500).delay(20000).fadeOut(500, nextMsg);
}else{
$('#message').hide();
}
}
$(function(){
$(".submitimage").click(function(e){
e.preventDefault();
nextMsg();
}
});
});
<input type="image" name="submitimage" src="generate-button.gif" class="submitimage" value="Generate Mock-up">