georgealways / lil-gui

Makes a floating panel for controllers on the web. Works as a drop-in replacement for dat.gui in most projects.
https://lil-gui.georgealways.com/
MIT License
1.15k stars 47 forks source link

[Howto request]: add onto document #129

Closed andybru closed 10 months ago

andybru commented 10 months ago

Hello, your small example:

gui.add( document, 'title' );

how to add something on the 'main' DOM makes me curious. What else could be made be able to edit on the main DOM-tree?

All the following failed:

gui.add( document, 'body' );
gui.add( document, 'h1' );
gui.add( document, '#test' );

Although 'body' failed differently.

Are there other HTML-elements or ID-elements easily added and then possibly modified?

Could I add for example a list of items (ul>li*) and replace their items?

Thanks for some Information.

georgealways commented 10 months ago

Hi there, it seems like your question is more about basic JS functionality rather than this library. I would look at the MDN docs to learn more about the DOM.

andybru commented 10 months ago

Actually I am rather not of this opinion.

With gui.add( document, 'title' ); you also add the -tag to the DOM. What is the lil-GUI reasoning behind this?