jakevdp / ipywidgets-static

[obsolete] Static Widgets for IPython Notebooks
BSD 3-Clause "New" or "Revised" License
108 stars 24 forks source link

Hiding div elements if function outputs HTML #11

Open Marigold opened 10 years ago

Marigold commented 10 years ago

If my widget function outputs HTML with div elements, control change would hide them. Try moving the slider in following example.

def foo(a):
    html = "<div id='linechart{}'><h1>{}</h1></div>".format(a,a)
    return html

StaticInteract(foo, a=RangeWidget(1, 5))

Problem is on this line. One way to fix that would be to only include direct children of widget div element via additional condition

else if((name != "controls") && (outputs[i].parentNode == div)){{