Forum Discussion

DavidSmith-1b8d's avatar
DavidSmith-1b8d
Community Member
9 months ago

Show an image or object with javascript

Hello!

I currently have a trigger that runs a javascript function that I am bringing over from HTML.

At the end of the function (shown below), I am trying to show a workspace/object. I'm not as familiar with pure javascript, is there a good way to show something in a DIV? Is there some other way to call the DIV to get it to show up?

<script>



(function(d, s, id){
    SE_BASE = "38071bda.containers.sphere-engine.com";
    SE_HTTPS = true;
    SE = window.SE || (window.SE = []);
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = (SE_HTTPS ? "https" : "http") + "://" + SE_BASE + "/static/sdk/sdk.min.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, "script", "sphere-engine-jssdk"));
  SE.ready = function(f){if (document.readyState != "loading" && document.readyState != "interactive") f();else window.addEventListener("load", f);};
  </script>

 

<div data-id="example-workspace" data-workspace="d66e075f45e44d2b9c02112f7e824e6b"></div>
    <script>
    SE.ready(function() {
        var workspace = SE.workspace("example-workspace");
    });



    </script>
  • Without seeing your project, the simplest method is to create two triggers; one to run the JS, and the next to show the object. If you can, change its state from Hidden to Normal, but if you can't do that, build a shape to cover it, and have the second trigger change the cover to Hidden.

    • DavidSmith-1b8d's avatar
      DavidSmith-1b8d
      Community Member

      Sorry I wasn't clear. I am creating a workspace (which I referred to as an object) and I want that shown. I'm not sure how storyline handles DIV , since it doesn't show the workspace. It's not an object in articulate.