如何更改dat.gui下拉列表的位置? [英] How do I change the location of the dat.gui dropdown?

查看:382
本文介绍了如何更改dat.gui下拉列表的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用dat.gui,我想将它放在与右上角不同的位置,最好是在顶部重叠一个three.js画布,这是通过命令完成的,还是有一些css可以执行技巧?

I am using dat.gui, and I would like to position it somewhere different than the top right, preferably at the top overlapping a three.js canvas, is this accomplished through commands, or is there some css that will do the trick?

推荐答案

你需要一些JavaScript和CSS才能做到这一点。

You need some JavaScript and CSS to do this.

GUI构造函数可以传递参数对象。您可以告诉控件不要自动播放。您还可以附加元素ID以使样式更容易

The GUI constructor can be passed a paramaters object. You can tell the control not to be autoplaced. You can also attach an element ID to make styling easier

var gui = new dat.GUI( { autoPlace: false } );
gui.domElement.id = 'gui';

然后放置它的CSS可以是这样的:

And then the CSS to place it can be something like this:

#gui { position: absolute; top: 2px; left: 2px }

这篇关于如何更改dat.gui下拉列表的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆