0

我希望在显示跨度时添加此功能。并在显示 div 时开始。目前它工作正常,但它会在页面加载后立即启动。我已经尝试了很多不同的选项,试图在 onclick('nextMSG();') 等上执行它,并且与 $(docment).onload(function){ 等相同

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>


我让它看起来像是在下载视频、转换等。

想法?

4

1 回答 1

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">
于 2013-06-12T19:23:57.460 回答