销毁jQuery Flot图
身后留下,如果你想删除的事件处理程序然后尝试jquery off
方法。
用于清除flot图。你可以清空div。
$('#yourFlotDiv').empty();
什么参数应该传递给jQuery.off()? – thecountofzero 2013-04-08 23:54:32
@thecountofzero $(“#yourFlotDiv”)。off(“yourEventHandlerTORemove”);有关更多信息,请参阅http://api.jquery.com/off/ – 2013-04-09 03:37:25
我正在讨论确保flot清理其所有事件处理程序并删除它创建的所有DOM元素。 – thecountofzero 2013-04-10 20:32:46
如果你读了API文档,还有就是你
shutdown()
Cleans up any event handlers Flot has currently registered. This
is used internally.
如清理关闭方法。
var plot = $.plot($("#yourDiv"), options)
plot.shutdown()
这是正确的和有效的。 – MirroredFate 2013-11-01 21:03:55
对于谁到这里来,将来的人,现在有一个destroy
函数调用关机和删除canvas元素。它无证由于某种原因在API中,但可在代码:
var flot = $("#FlotDiv").data('plot')
if (flot) // If it's destroyed, then data('plot') will be undefined
flot.destroy();
要删除的海军报图
var placeholder = $("#FlotDiv");
placeholder.unbind(); //Remove a previously-attached event handler from the elements.
placeholder.empty();
而且如果你想解除绑定特定的事件,这是要走的路:
$("#foo").unbind("click");
欲了解更多信息,请查阅this。
'$ .plot('#yourFlotDiv',{},{});'读它的地方。不记得在哪里。 – Ejaz 2013-04-10 20:35:41