Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="viewer-container">
    <h1>Left viewer</h1>
    <div id="container"></div>
    <button onclick="first_left();">First scene</button>
    <button onclick="next_left();">Next scene</button>
</div>

<div class="viewer-container">
    <h1>Right viewer</h1>
    <div id="container2"></div>
    <button onclick="first_right();">First scene</button>
    <button onclick="next_right();">Next scene</button>
</div>
              
            
!

CSS

              
                html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

div#container, div#container2 {
    position: relative;
    width: 400px;
    height: 300px;
}
.viewer-container{
    display: inline-block;
    background-color: #000;
    color: #fff;
}
              
            
!

JS

              
                var pano = [
    "https://img.gothru.co/1618/9725513847287964533/vcK3LR9IEy4AAAQvPHxieQ_thumb.jpg?resize=800x,shrink&save=optimize",
    "https://img.gothru.co/1618/9725513847287964533/13F54MmPtrwAAAQvPHxiaw_thumb.jpg?resize=800x,shrink&save=optimize",
    "https://img.gothru.co/1618/9725513847287964533/4lA5nLcTSrEAAAQvPHxieg_thumb.jpg?resize=800x,shrink&save=optimize"
];

var pano2 = [
    "https://img.gothru.co/1618/9725513847287964533/FNOODWh4tqgAAAQvPHxiew_thumb.jpg?resize=800x,shrink&save=optimize",
    "https://img.gothru.co/1618/9725513847287964533/tixBU3T7YLsAAAQvPHxifA_thumb.jpg?resize=800x,shrink&save=optimize",
    "https://img.gothru.co/1618/9725513847287964533/CfqeuRfuSYQAAAQvPHxifg_thumb.jpg?resize=800x,shrink&save=optimize",
    "https://img.gothru.co/1618/9725513847287964533/UoqlMAzXiNQAAAQvPHxifw_thumb.jpg?resize=800x,shrink&save=optimize"
];

var config = {
    "history": {
        "enabled": false
    },
    "story": {
        "name": "My Story1",
        "slug": "my-story1",
        "uid": "first-scenes-story",
        "default": "p0",
        "scenes": []
    }
};

var config2 = {
    "history": {
        "enabled": false
    },
    "story": {
        "name": "My Story2",
        "slug": "my-story2",
        "uid": "second-scenes-story",
        "default": "c0",
        "scenes": []
    }
};

pano.forEach(function(item, i, arr) {
    config.story.scenes.push({
		"uid": 'p'+i.toString(),
		"media": {
			"type": "image",
			"source": {
				"format": "equi",
				"url": item
			}
		}
	});
});

pano2.forEach(function(item, i, arr) {
    config2.story.scenes.push({
		"uid": 'c'+i.toString(),
		"media": {
			"type": "image",
			"source": {
				"format": "equi",
				"url": item
			}
		}
	});
});

// Create a viewer
var left_viewer = new FORGE.Viewer("container", config);
var right_viewer = new FORGE.Viewer("container2", config2);

function first_left(){
    left_viewer.story.loadScene("p0");
}

function next_left(){
    left_viewer.story.nextScene();
}

function first_right(){
    right_viewer.story.loadScene("c0");
}

function next_right(){
    right_viewer.story.nextScene();
}
              
            
!
999px

Console