2012-07-07 83 views
0

你好我想弄清楚如何解决这个上传进度条,以便它在Firefox中工作。jQuery形式上传进度

在Firefox那就只在90%左右的铬以100%

任何想法是极大的赞赏

*欢呼

编辑我应该提到这是显示进度使用jQuery的形式插件http://jquery.malsup.com/form/

编辑不知道我做了什么,但现在状态设置为99%,任何想法如何得到它在Firefox 100%:-)

我已经更新下面

<style> 
<!-- 
/*form {display: block; background: #333; padding: 15px}*/ 

.progress {margin-left:auto; margin-right: auto; position:relative; width:400px; border: 1px solid #ddd; padding: 1px; border-radius: 3px;} 
.bar {margin-left:auto; margin-right: auto;background-color: #B4F5B4; width:0%; height:20px; border-radius: 3px; } 
.percent {position:absolute; display:inline-block; top:3px; left:48%;} 
--> 
</style> 

和jQuery的下面

码的代码

 <div class="progress"> 
     <div class="bar"></div > 
     <div class="percent">0%</div > 
    </div> 
    <div id="status"></div> 


<script type='text/javascript'> 
<!-- 

jQuery('document').ready(function() { 
    var bar = $('.bar'); 
    var percent = $('.percent'); 
    var status = $('#status'); 
     $('form').ajaxForm({ 
      dataType: 'script', 
      url: "{{=URL('default', 'user_song_form')}}", 
      beforeSend: function() { 
       status.empty(); 
       var percentVal = '0%'; 
       bar.width(percentVal) 
       percent.html(percentVal); 
      },    
      uploadProgress: function(event, position, total, percentComplete) { 
       var percentVal = percentComplete + '%'; 
       bar.width(percentVal) 
       percent.html(percentVal); 
      }, 
      complete: function(xhr) { 
       status.html('Thank You Upload Complete!'); 
      }  
     });   
    });  
--> 

</script> 

回答

0

考虑使用uploadify作为替代。它的工作原理非常好,通过改变完整的功能在IE和Firefox 100%的工作

http://www.uploadify.com/

+2

我试图让uploadify至3天的工作,但一直得到一个HTTP错误或IO错误,我读了几个职位上没有什么是能够解决它。所以在这一点上我没有什么好说的Uploadify,并且Flash在大多数移动平台上都不起作用......无论如何ty :-) – user1243337 2012-07-07 16:23:27

1

我固定我与上传状态有问题

现在jQuery代码如下所示

<script type='text/javascript'> 
<!-- 

jQuery('document').ready(function() { 
    var bar = $('.bar'); 
    var percent = $('.percent'); 
    var status = $('#status'); 
     $('form').ajaxForm({ 
      dataType: 'script', 
      url: "{{=URL('default', 'user_song_form')}}", 
      beforeSend: function() { 
       status.empty(); 
       var percentVal = '0%'; 
       bar.width(percentVal) 
       percent.html(percentVal); 
      },    
      uploadProgress: function(event, position, total, percentComplete) { 
       var percentVal = percentComplete + '%'; 
       bar.width(percentVal) 
       percent.html(percentVal); 
      }, 
      complete: function(xhr) { 
       var percentVal = '100%'; 
       bar.width(percentVal) 
       percent.html(percentVal); 
       status.html('Thank You Upload Complete!'); 
      }  
     });   
    });  
--> 

</script>