首页 > 解决方案 > 渲染器之上的 THREE.js html 仅在动态生成组件时才有效

问题描述

在网站中使用 THREE.js 时,每当我制作这样的元素时:

<p style='color:white;position:absolute;left:10px;top:10px;'></p>

元素总是出现在渲染器之前或之后,而不是在顶部。但是,当我动态生成组件时,如下所示:

var sun = document.createElement('div');
sun.className = 'sun';
sun.id = 'sun';
sun.style.right = window.innerWidth/2+'px';
sun.style.top = '100px';
sun.style.position = 'absolute';

它按我想要的方式放置,

任何帮助表示赞赏

标签: cssthree.js

解决方案


推荐阅读