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

              
                <!-- define a div element that will hold the 360 HD Viewer -->
<div class="column">
  <div id="put-viewer-here"></div>
</div>

<!-- Variation Selector -->
<div class="column small">
  <p class="list-label">Upholstery</p>
  <!-- the data-feature-type attribute is being used when changing features -->
  <ul data-feature-type="UPHOLSTERY" class="variation-selector upholstery">
    <!-- the data-feature-value attribute is being used when changing features -->
    <li data-feature-value="MUSHROOM" class="variation selected" style="background: #797375"></li>
    <li data-feature-value="EARTH" class="variation" style="background: #C5B7A2"></li>
  </ul>
  <p class="list-label">Legs Finish</p>
  <ul data-feature-type="LEGS" class="variation-selector legs">
    <li data-feature-value="METAL_LEGS" class="variation selected" style="background: #FAFAFA"></li>
    <li data-feature-value="ROUNDLEG_OW" class="variation" style="background: #7D6143"></li>
  </ul>
</div>
              
            
!

CSS

              
                /* General Styles */
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600);
body{
  font-family: 'Open Sans';
}

.column {
  width:548px;
  display:inline-block;
  vertical-align:top;
}

.column.small {
  width:110px;
  margin-left:35px;
}

hr {
  border:none;
  height:1px;
  background:rgba(0,0,0,0.1);
  margin:20px 0;
}

/* Swatch styles */

.list-label {
  text-transform:uppercase;
  font-weight:500;
  font-size:11px;
  margin:0px;
}

/*Variation Selector Styles*/
.variation-selector {
  width:110px;
  display:block;
  list-style:none;
  padding:0;
  margin:0;
}

.variation-selector .variation {
  width:32px;
  height:32px;
  display:inline-block;
  border-radius:0px;
  cursor:pointer;
}

.variation-selector .variation:hover:before,
.variation-selector .variation.selected:before{
  content:"✓";
  width:32px;
  height:32px;
  background:rgba(0,0,0,0.1);
  border-radius:0px;
  position:absolute;
  text-align:center;
  line-height:32px;
  color:white;
  text-shadow:0px 2px 4px rgba(0,0,0,0.7);
  font-size:15px;
}

/*Override style for the viewer tooltip text */
.cylindo-drag-tooltip,.cylindo-zoom-drag-tooltip{
  color:#B2A2D3 !important;
}
              
            
!

JS

              
                // declare the variable that will hold the 360 HD Viewer instance
var viewerInstance = null;
// the opts object should hold the start properties of the 360 HD Viewer
var opts = { 
  'accountID': 4965,
  'productCode': 'EMMA_ARMCHAIR',
  'features': ["UPHOLSTERY", "MUSHROOM", "LEGS", "METAL_LEGS"],
  'containerID': '#put-viewer-here',
}

// make sure the cylindo framework has been "installed"
if (cylindo) {
  // do not instantiate the viewer until the framework reports ready.
  cylindo.on('ready', function () {
    // create the instance
    viewerInstance = cylindo.viewer.create(opts);
  });
}

//Variation selection handler 
$(".variation").click( function() {
  //remove the class "selected" from all li elements
  $(this).parent().find("li").removeClass("selected");
  //add the class "selected" to the current clicked element
  $(this).addClass("selected");  
  
  //create array with values from the selected ones
  var featureArray = [ 
    //get the first feature type name
    $(".upholstery").attr("data-feature-type"),
    //get the feature value for the feature type above
    $(".upholstery .selected").attr("data-feature-value"),
    //get the second feature type name
    $(".legs").attr("data-feature-type"),    
    //get the feature value for the feature type above
    $(".legs .selected").attr("data-feature-value"),
  ];
  //this viewer function sends an array with the new selected features
  viewerInstance.setFeatures(featureArray);
});




              
            
!
999px

Console