以一种清理所有事件处理程序而不会导致内存泄漏的方式销毁jQuery flot图的正确方法是什么?
似乎flot留下了一些僵尸(又名Detached Dom Trees)
如果您阅读了API文档,那么有一种关闭方法可以为您清理
shutdown()
Cleans up any event handlers Flot has currently registered. This
is used internally.
Run Code Online (Sandbox Code Playgroud)
例如.
var plot = $.plot($("#yourDiv"), options)
plot.shutdown()
Run Code Online (Sandbox Code Playgroud)
如果您想删除事件处理程序,请尝试jquery off方法。
用于清除流程图。你可以清空div。
$('#yourFlotDiv').empty();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5250 次 |
| 最近记录: |