Add Properties Toolbar next to viewer

I am trying to add a fixed properties tab to the right side of my screen. Sadly I am unable to force the Viewer to the left 80% of my screen. Therefore my properties panel is hiding the right 20% of my viewer.

I tried to force the two elements in place with styling, but with no success. The viewer always uses up 100% of the Screen and is therefore partially hidden.

My Code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no" />
<meta charset="utf-8">
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
display: flex;
overflow: hidden;
}
#container {
display: flex;
width: 100%;
height: 100%;
}
#forgeViewer {
flex: 1;
width: 80%;
height: 100%;
background: #f0f0f0;
flex-shrink: 0;
z-index: 1;
}
#propertyPanel {
width: 20%;
height: 100%;
overflow-y: auto;
border-left: 1px solid #ccc;
padding: 10px;
box-sizing: border-box;
background: #fff;
z-index: 2;
position: relative;
}
</style>
</head>
<body>
<div id="container">
<div id="forgeViewer"></div>
<div id="propertyPanel">
<h2>Properties</h2>
<div id="propertyContent"></div>
</div>
</div>
<script>
var viewer;
var options = {
env: 'AutodeskProduction2',
api: 'streamingV2', // for models uploaded to EMEA change this option to 'streamingV2_EU'
getAccessToken: function(onTokenReady) {
var token = '<My Access Token>';
var timeInSeconds = 3600; // Use value provided by APS Authentication (OAuth) API
onTokenReady(token, timeInSeconds);
}
};
Autodesk.Viewing.Initializer(options, function() {
var htmlDiv = document.getElementById('forgeViewer');
viewer = new Autodesk.Viewing.GuiViewer3D(htmlDiv);
var startedCode = viewer.start();
if (startedCode > 0) {
console.error('Failed to create a Viewer: WebGL not supported.');
return;
}
console.log('Initialization complete, loading a model next...');
var documentId = 'urn:<My URN>';
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
function onDocumentLoadSuccess(viewerDocument) {
var defaultModel = viewerDocument.getRoot().getDefaultGeometry();
viewer.loadDocumentNode(viewerDocument, defaultModel);
}
function onDocumentLoadFailure() {
console.error('Failed fetching Forge manifest');
}
viewer.addEventListener(Autodesk.Viewing.SELECTION_CHANGED_EVENT, function(event) {
const dbIds = event.dbIdArray;
if (dbIds.length > 0) {
viewer.getProperties(dbIds[0], function(props) {
displayProperties(props);
});
} else {
clearProperties();
}
});
function displayProperties(props) {
const propertyContent = document.getElementById('propertyContent');
propertyContent.innerHTML = '';
for (const prop of props.properties) {
const propDiv = document.createElement('div');
propDiv.innerHTML = `<strong>${prop.displayName}</strong>: ${prop.displayValue}`;
propertyContent.appendChild(propDiv);
}
}
function clearProperties() {
const propertyContent = document.getElementById('propertyContent');
propertyContent.innerHTML = '<p>No properties available</p>';
}
});
</script>
</body>
</code>
<code><head> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no" /> <meta charset="utf-8"> <link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css"> <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script> <style> body, html { margin: 0; padding: 0; width: 100%; height: 100%; display: flex; overflow: hidden; } #container { display: flex; width: 100%; height: 100%; } #forgeViewer { flex: 1; width: 80%; height: 100%; background: #f0f0f0; flex-shrink: 0; z-index: 1; } #propertyPanel { width: 20%; height: 100%; overflow-y: auto; border-left: 1px solid #ccc; padding: 10px; box-sizing: border-box; background: #fff; z-index: 2; position: relative; } </style> </head> <body> <div id="container"> <div id="forgeViewer"></div> <div id="propertyPanel"> <h2>Properties</h2> <div id="propertyContent"></div> </div> </div> <script> var viewer; var options = { env: 'AutodeskProduction2', api: 'streamingV2', // for models uploaded to EMEA change this option to 'streamingV2_EU' getAccessToken: function(onTokenReady) { var token = '<My Access Token>'; var timeInSeconds = 3600; // Use value provided by APS Authentication (OAuth) API onTokenReady(token, timeInSeconds); } }; Autodesk.Viewing.Initializer(options, function() { var htmlDiv = document.getElementById('forgeViewer'); viewer = new Autodesk.Viewing.GuiViewer3D(htmlDiv); var startedCode = viewer.start(); if (startedCode > 0) { console.error('Failed to create a Viewer: WebGL not supported.'); return; } console.log('Initialization complete, loading a model next...'); var documentId = 'urn:<My URN>'; Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure); function onDocumentLoadSuccess(viewerDocument) { var defaultModel = viewerDocument.getRoot().getDefaultGeometry(); viewer.loadDocumentNode(viewerDocument, defaultModel); } function onDocumentLoadFailure() { console.error('Failed fetching Forge manifest'); } viewer.addEventListener(Autodesk.Viewing.SELECTION_CHANGED_EVENT, function(event) { const dbIds = event.dbIdArray; if (dbIds.length > 0) { viewer.getProperties(dbIds[0], function(props) { displayProperties(props); }); } else { clearProperties(); } }); function displayProperties(props) { const propertyContent = document.getElementById('propertyContent'); propertyContent.innerHTML = ''; for (const prop of props.properties) { const propDiv = document.createElement('div'); propDiv.innerHTML = `<strong>${prop.displayName}</strong>: ${prop.displayValue}`; propertyContent.appendChild(propDiv); } } function clearProperties() { const propertyContent = document.getElementById('propertyContent'); propertyContent.innerHTML = '<p>No properties available</p>'; } }); </script> </body> </code>
<head>
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no" />
  <meta charset="utf-8">

  <link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
  <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>

  <style>
    body, html {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      display: flex;
      overflow: hidden;
    }
    #container {
      display: flex;
      width: 100%;
      height: 100%;
    }
    #forgeViewer {
      flex: 1;
      width: 80%;
      height: 100%;
      background: #f0f0f0;
      flex-shrink: 0;
      z-index: 1;
    }
    #propertyPanel {
      width: 20%;
      height: 100%;
      overflow-y: auto;
      border-left: 1px solid #ccc;
      padding: 10px;
      box-sizing: border-box;
      background: #fff;
      z-index: 2;
      position: relative;
    }
  </style>
</head>
<body>

<div id="container">
  <div id="forgeViewer"></div>
  <div id="propertyPanel">
    <h2>Properties</h2>
    <div id="propertyContent"></div>
  </div>
</div>

<script>
  var viewer;
  var options = {
    env: 'AutodeskProduction2',
    api: 'streamingV2',  // for models uploaded to EMEA change this option to 'streamingV2_EU'
    getAccessToken: function(onTokenReady) {
      var token = '<My Access Token>';
      var timeInSeconds = 3600; // Use value provided by APS Authentication (OAuth) API
      onTokenReady(token, timeInSeconds);
    }
  };

  Autodesk.Viewing.Initializer(options, function() {

    var htmlDiv = document.getElementById('forgeViewer');
    viewer = new Autodesk.Viewing.GuiViewer3D(htmlDiv);
    var startedCode = viewer.start();
    if (startedCode > 0) {
      console.error('Failed to create a Viewer: WebGL not supported.');
      return;
    }

    console.log('Initialization complete, loading a model next...');

    var documentId = 'urn:<My URN>';
    Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);

    function onDocumentLoadSuccess(viewerDocument) {
      var defaultModel = viewerDocument.getRoot().getDefaultGeometry();
      viewer.loadDocumentNode(viewerDocument, defaultModel);
    }

    function onDocumentLoadFailure() {
      console.error('Failed fetching Forge manifest');
    }


    viewer.addEventListener(Autodesk.Viewing.SELECTION_CHANGED_EVENT, function(event) {
      const dbIds = event.dbIdArray;
      if (dbIds.length > 0) {
        viewer.getProperties(dbIds[0], function(props) {
          displayProperties(props);
        });
      } else {
        clearProperties();
      }
    });

    function displayProperties(props) {
      const propertyContent = document.getElementById('propertyContent');
      propertyContent.innerHTML = '';
      for (const prop of props.properties) {
        const propDiv = document.createElement('div');
        propDiv.innerHTML = `<strong>${prop.displayName}</strong>: ${prop.displayValue}`;
        propertyContent.appendChild(propDiv);
      }
    }

    function clearProperties() {
      const propertyContent = document.getElementById('propertyContent');
      propertyContent.innerHTML = '<p>No properties available</p>';
    }



  });

</script>
</body>

The Result:
enter image description here
As you can see the view Cube in the top right corner is fully hidden behind the properties tab. I only managed to get the desired results by manually changing the css in the website dev-tools:
enter image description here

New contributor

user25662092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật