2011-04-28 71 views
2

我在一個小型的jQuery移動框架網站中實現flot。包含flot的頁面/內容div位於輔助頁面上。第一次顯示flot頁面時,圖表很好地呈現。回到主頁面並再次轉發到頁面,圖表不會呈現。jquery mobile和flot庫

內容是從ASP MVC視圖來:

<div id="chartcontainer"> 
    <div id="chartdiv" style="height:300px;width:400px;"></div> 
</div> 
<script type="text/javascript"> 
$(function() { 
    var d1 = [[1, 1], [2, 2], [3, 3]]; 
    $.plot($("#chartdiv"), [d1]); 
}); 
</script> 

回答

1

您可能需要刷新頁面,嘗試。第()

$.plot($("#chartdiv"), [d1]).page(); 
1

文件準備通常是沒有按」一件事t按照預期與jQuery Mobile一起工作。

代替$(function(){})嘗試綁定到page*事件是這樣的:

$('div#withMYgrid').live('pageshow',function(){ 
//plot here 
});