2013-12-19 22 views
-1

我是building a site與Twitter Bootstrap,並在幾頁上我有一個進度條加載,但隨後它消失。我希望它加載並保持。Boostrap進度條加載,但然後消失

Here's the website以及我所指的頁面。進度條位於右側。

custom.js的JavaScript代碼如下:

/* ------------------ Progress Bar ------------------- */ 
$(function() { 
    $(".meter > span").each(function() { 
     $(this) 
     .data("origWidth", $(this).width()) 
     .width(0) 
     .animate({ 
      width: $(this).data("origWidth") 
     }, 1200); 
    }); 
}); 
+0

設置錯誤,仔細檢查 – teemo

+0

你是什麼意思? – GSaunders

+0

請在問題中包含相關代碼(Javascript,HTML片段)或鏈接到一個小的JSFiddle示例。 – nietonfir

回答

1

的問題是,在動畫播放完畢後,您沒有設置原始寬度回來,所以它只是顯示與修改後的0寬度的條。

更改進度欄部分在custom.js文件到這一點:

$(function() { 
    $(".meter > span").each(function() { 
     var width = $(this).width(); 
     $(this) 
      .width(0) 
      .animate({ 
       width: width 
      }, 1200) 
      .width(width); 
    }); 
}); 
+0

現在工作很好。謝謝! – GSaunders