2016-05-29 153 views
0

使用github中的无冲突/ ace.js src在localhost中运行ace.js。ace.js内容不显示内容

<div id="edit" style='position:relative;top:0px;left:0px;bottom:0px;right:0px;'> 
     function(){ 
      this.id=5; 
     } 
</div> 
    <script> 
      var editor=ace.edit(document.getElementById('edit')); 
      editor.setValue("var test='this is a test line';") 
      editor.setTheme("ace/theme/monokai"); 
      editor.getSession().setMode("ace/mode/javascript"); 


    </script> 

它启动编辑器,在控制台中添加没有错误的所有ace特定元素,但用户不可见。没有我的元素被隐藏,所以我没有想法...

编辑 确认的主题正在加载和工作。

回答

1

你的内联css是错误的。

设置这样的:

<div id="edit" style='position:absolute;top:0px;left:0px;bottom:0px;right:0px;'> 

我想,你希望它全屏所以position应该是绝对的,您没有设置;bottom:0px

在这里,你可以看到它的jsfiddle https://jsfiddle.net/kkd34n05/

+0

好抓,但没有改变任何东西。 – user2782001

+0

嗯我在本地尝试过,它工作正常.. – jakob

+0

检查更新回答jsfiddle测试 – jakob