Summary:
| Control | Type | Description |
|---|---|---|
| width | style | viewer width (ending in px or %) |
| height | style | viewer height (ending in px or %) |
| display | style | specify none to hide a model (it will still be accessible via next/previous buttons) |
| resizable | attribute | specify true if the viewer should be resizable (requires additional jQuery reference) |
| targetActive | attribute | specify true if clicking should target the active viewer |
| gotoVideo(MODEL_ID) | javascript | call this function on the 3defy_viewer element to load a model into the active viewer |
Embedding a Single 3D Model:
To embed a single model, just copy and paste the embed code into the body of an HTML page. The 3Defy Viewer will get embedded at the position of the embed code.<script type="text/javascript" src="http://apps.3defy.com/js/3defyembed.js"></script> <div class="3defy" resizable="false" style="width:480px;height:360px;" model="MODEL_ID"></div>
Changing the Viewer Size:
Embedded models will default to 480x360 pixels, as indicated by the default embed code:style="width:480px;height:360px;"
Making the Viewer Resizable:
By default, models will be embedded at the width and height you specify, and will not be resizable by the user. This is indicated by the default embed code:resizable="false"
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
resizable="true"
Embedding Multiple 3D Models in a Page:
You can embed more than one model in a single web page. For performance reasons, only one model will be active at a time. The others will display thumbnails, and can be activated by clicking on their thumbnails.
<head>
<script type="text/javascript" src="http://apps.3defy.com/js/3defyembed.js"></script>
</head>
<body>
<div class="3defy" resizable="false" style="width:480px;height:360px;" model="MODEL_ID_1"></div>
<div class="3defy" resizable="false" style="width:480px;height:360px;" model="MODEL_ID_2"></div>
<div class="3defy" resizable="false" style="width:480px;height:360px;" model="MODEL_ID_3"></div>
</body>
Using a Single Viewer for Multiple 3D Models:
Since only one model can be active at a time, you may prefer to have a single viewer and let the user just browse the models with the Next and Previous buttons.
<head>
<script type="text/javascript" src="http://apps.3defy.com/js/3defyembed.js"></script>
</head>
<body>
<div class="3defy" resizable="false" style="width:480px;height:360px;" model="MODEL_ID_1"></div>
<div class="3defy" resizable="false" style="width:480px;height:360px;display:none;" model="MODEL_ID_2"></div>
<div class="3defy" resizable="false" style="width:480px;height:360px;display:none;" model="MODEL_ID_3"></div>
</body>
Using a Single Viewer for Multiple 3D Models with Thumbnails:
Suppose you want to have multiple thumbnails which load their models into a single viewer. You can use the parameter targetActive="true" to indicate that a model should be loaded into the active viewer.
<head>
<script type="text/javascript" src="http://apps.3defy.com/js/3defyembed.js"></script>
</head>
<body>
<div class="3defy" resizable="false" style="width:480px;height:360px;" model="MODEL_ID_1"></div>
<div class="3defy" resizable="false" targetActive="true" style="width:100px;height:75px;" model="MODEL_ID_1"></div>
<div class="3defy" resizable="false" targetActive="true" style="width:100px;height:75px;" model="MODEL_ID_2"></div>
<div class="3defy" resizable="false" targetActive="true" style="width:100px;height:75px;" model="MODEL_ID_3"></div>
</body>
Using JavaScript to Create a Custom Integration:
Once you have embedded a 3Defy Viewer on a web page, you can use JavaScript to load a model into it dynamically:
document.getElementById('3defy_viewer').gotoModel('MODEL_ID')
Support:
If you experience any issues using the Embedding API, please report them in our Forums.
Share 3Defy: