一旦显示div,jquery加载函数
我希望在显示范围时添加此函数。并在显示div时启动。目前,它可以正常工作,但它会在页面加载后立即启动。我在onclick('nextsg();')等和$(docment.onload(function){等上尝试了许多不同的选项 目前我的onclick没有这个功能。其他功能都正常。它显示了我的图像等,这很好。但是我想添加上面的信息,这样看起来它好像在做其他事情。更多的只是一个视觉效果一旦显示div,jquery加载函数,jquery,Jquery,我希望在显示范围时添加此函数。并在显示div时启动。目前,它可以正常工作,但它会在页面加载后立即启动。我在onclick('nextsg();')等和$(docment.onload(function){等上尝试了许多不同的选项 目前我的onclick没有这个功能。其他功能都正常。它显示了我的图像等,这很好。但是我想添加上面的信息,这样看起来它好像在做其他事情。更多的只是一个视觉效果 <input type="image" name="submit" src="generate-butto
<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>
我让它看起来像是在下载视频,转换等等
想法?首先要解决的问题是:
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">
var消息=[
“下载视频…”,
“将视频转换为网络友好格式…”,
“结合视频和布局…”,
“为客户准备电子邮件…”,
“发送电子邮件…”,
“已发送电子邮件!”
].reverse();
函数nextsg(){
如果(messages.length>0){
$('#message').html(messages.pop()).fadeIn(500).delay(20000).fadeOut(500,nextsg);
}否则{
$(“#消息”).hide();
}
}
$(函数(){
$(“.submitimage”)。单击(函数(e){
e、 预防默认值();
nextsg();
}
});
});
您不能有两个return
s。另外,如果您使用的是jQuery,为什么要使用onclick
HTML属性?
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">