2011-04-28 72 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 
});